Add more test

This commit is contained in:
WQY\qiong
2023-04-30 12:04:52 +08:00
parent a4dc2d62cc
commit 8d49db2942
2 changed files with 95 additions and 40 deletions

View File

@@ -1,6 +1,6 @@
from .database import *
from .s0_base import get_node_links
from .s32_region_util import calculate_boundary, calculate_convex_hull, inflate_boundary
#from .s32_region_util import calculate_boundary, calculate_convex_hull, inflate_boundary
def calculate_virtual_district(name: str, centers: list[str]) -> dict[str, Any]:
@@ -62,9 +62,9 @@ def calculate_virtual_district(name: str, centers: list[str]) -> dict[str, Any]:
vds: list[dict[str, Any]] = []
for center, value in center_node.items():
p = calculate_boundary(name, value)
b = inflate_boundary(name, p)
c = calculate_convex_hull(name, value)
vds.append({ 'center': center, 'nodes': value, 'path': p, 'boundary': b, 'convex_hull': c})
#p = calculate_boundary(name, value)
#b = inflate_boundary(name, p)
#c = calculate_convex_hull(name, value)
vds.append({ 'center': center, 'nodes': value })
return { 'virtual_districts': vds, 'isolated_nodes': isolated_nodes }