You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pygsp library currently does not support the visualization of directed graphs with arrowheads on edges. When using the plot_graph function to visualize a graph created from a directed adjacency matrix, the edges are displayed as undirected lines without any indication of directionality (e.g., arrowheads).
For example, consider the following directed graph defined by the adjacency matrix:
importnumpyasnpimportpygspasgsp# Define a directed graph using an adjacency matrixW=np.array([
[0, 3, 7, 0, 0], # Node 1 → Node 2 (weight=3), Node 1 → Node 3 (weight=7)
[0, 0, 0, 5, 0], # Node 2 → Node 4 (weight=5)
[0, 0, 0, 2, 0], # Node 3 → Node 4 (weight=2)
[0, 0, 0, 0, 4], # Node 4 → Node 5 (weight=4)
[0, 0, 0, 0, 0] # Node 5 has no outgoing edges
])
G=gsp.graphs.Graph(W) # Create a graph from the adjacency matrixG.set_coordinates(seed=42) # Set coordinates for visualization
When visualizing this graph using gsp.plotting.plot_graph(G), the edges are displayed as undirected lines, even though the adjacency matrix explicitly defines directed edges.
Expected Behavior:
The edges should be displayed with arrowheads to indicate the direction of each edge.
The visualization should clearly distinguish between directed and undirected graphs.
Current Behavior:
The edges are displayed as undirected lines, regardless of the adjacency matrix being directed or undirected.
Proposed Solution:
Add an optional parameter (e.g., directed=True) to the plot_graph function to enable visualization of directed graphs with arrowheads.
Use Matplotlib's arrow functionality to draw directed edges with customizable arrow styles (e.g., arrowheads, colors, widths).
Workaround:
Currently, users can manually draw directed edges using Matplotlib's arrow function, but this requires additional code and is not integrated into the plot_graph functionality.
The
pygsp
library currently does not support the visualization of directed graphs with arrowheads on edges. When using theplot_graph
function to visualize a graph created from a directed adjacency matrix, the edges are displayed as undirected lines without any indication of directionality (e.g., arrowheads).For example, consider the following directed graph defined by the adjacency matrix:
When visualizing this graph using
gsp.plotting.plot_graph(G)
, the edges are displayed as undirected lines, even though the adjacency matrix explicitly defines directed edges.Expected Behavior:
Current Behavior:
Proposed Solution:
directed=True
) to theplot_graph
function to enable visualization of directed graphs with arrowheads.arrow
functionality to draw directed edges with customizable arrow styles (e.g., arrowheads, colors, widths).Workaround:
Currently, users can manually draw directed edges using Matplotlib's
arrow
function, but this requires additional code and is not integrated into theplot_graph
functionality.Example Workaround Code:
This workaround demonstrates how directed edges can be visualized, but it would be ideal to have this functionality built into
pygsp
.The text was updated successfully, but these errors were encountered: