Graph Visualization

Graph visualization helpers.

asunder.base.visualization.graphs.draw_network(G, community_map)

Draw a graph with node colors defined by an explicit community map.

Parameters:
  • G (nx.Graph) – NetworkX graph.

  • community_map (dict) – Map from node index to community index.

asunder.base.visualization.graphs.draw_network_with_labels(G, community_map_labels, label=True, color_edges=False, legend=True, title=True, figsize=None, seed=42)

Draw a community-colored graph with optional labels, legend, and edge styling.

Parameters:
  • G (nx.Graph) – NetworkX graph.

  • community_map_labels (dict[str, int]) – Map from node label to community index.

  • label (bool) – Show labels if True.

  • color_edges (bool) – Color edges if True.

  • legend (Any) – Show legend if True.

  • title (Any) – Show title if True.

  • figsize (tuple[int, int]) – Figure size of diagram.

  • seed (int) – Random seed value.

asunder.base.visualization.graphs.draw_colored_constraint_graph(G, node_type=None, edge_type=None, color_nodes_by_type=True, color_edges_by_type=True, node_homog_color='#00274C', edge_homog_color='gray', linear_color='#00274C', nonlinear_color='#FFCB05', cont_color='#FFCB05', int_color='#00274C')

Render constraint graph with node/edge styling by linearity and variable type.

Parameters:
  • G (nx.Graph) – NetworkX graph.

  • node_type (dict) – Mapping from node to node type.

  • edge_type (dict) – Mapping from edge to edge type.

  • color_nodes_by_type (bool) – Color nodes by node type if True.

  • color_edges_by_type (bool) – Color edges by edge type if True.

  • node_homog_color (str) – Color code for homogeneously colored nodes.

  • edge_homog_color (str) – Color code for homogeneously colored edges.

  • linear_color (str) – Color code for linear nodes.

  • nonlinear_color (str) – Color code for nonlinear nodes.

  • cont_color (str) – Color code for continuous edges.

  • int_color (str) – Color code for integer edges.