(
ax: Axes,
v_coor: List[Tuple[float, float]],
v_size: list,
e_list: List[Tuple[int, int]],
e_color: list,
e_fill_color: list,
e_line_width: list,
)
| 73 | |
| 74 | |
| 75 | def draw_circle_edge( |
| 76 | ax: Axes, |
| 77 | v_coor: List[Tuple[float, float]], |
| 78 | v_size: list, |
| 79 | e_list: List[Tuple[int, int]], |
| 80 | e_color: list, |
| 81 | e_fill_color: list, |
| 82 | e_line_width: list, |
| 83 | ): |
| 84 | n_v = len(v_coor) |
| 85 | line_paths, arc_paths, vertices = hull_layout(n_v, e_list, v_coor, v_size) |
| 86 | |
| 87 | for eidx, lines in enumerate(line_paths): |
| 88 | pathdata = [] |
| 89 | for line in lines: |
| 90 | if len(line) == 0: |
| 91 | continue |
| 92 | start_pos, end_pos = line |
| 93 | pathdata.append((Path.MOVETO, start_pos.tolist())) |
| 94 | pathdata.append((Path.LINETO, end_pos.tolist())) |
| 95 | |
| 96 | if len(list(zip(*pathdata))) == 0: |
| 97 | continue |
| 98 | codes, verts = zip(*pathdata) |
| 99 | path = Path(verts, codes) |
| 100 | ax.add_patch( |
| 101 | PathPatch( |
| 102 | path, |
| 103 | linewidth=e_line_width[eidx], |
| 104 | facecolor=e_fill_color[eidx], |
| 105 | edgecolor=e_color[eidx], |
| 106 | ) |
| 107 | ) |
| 108 | |
| 109 | for eidx, arcs in enumerate(arc_paths): |
| 110 | for arc in arcs: |
| 111 | center, theta1, theta2, radius = arc |
| 112 | x, y = center[0], center[1] |
| 113 | |
| 114 | ax.add_patch( |
| 115 | matplotlib.patches.Arc( |
| 116 | (x, y), |
| 117 | 2 * radius, |
| 118 | 2 * radius, |
| 119 | theta1=theta1, |
| 120 | theta2=theta2, |
| 121 | # color=e_color[eidx], |
| 122 | linewidth=e_line_width[eidx], |
| 123 | edgecolor=e_color[eidx], |
| 124 | facecolor=e_fill_color[eidx], |
| 125 | ) |
| 126 | ) |
| 127 | |
| 128 | |
| 129 | def edge_list_to_incidence_matrix(num_v: int, e_list: List[tuple]) -> np.ndarray: |
no test coverage detected