epfl-lts2 / pygsp

Graph Signal Processing in Python
https://pygsp.rtfd.io
BSD 3-Clause "New" or "Revised" License
488 stars 93 forks source link

line graph #50

Closed mdeff closed 5 years ago

mdeff commented 5 years ago
graph = pg.graphs.Sensor(5, k=2, seed=10)
line_graph = pg.graphs.LineGraph(graph)
fig, ax = plt.subplots()
graph.plot(vertex_color='blue', edge_color='blue', indices=True, ax=ax)
line_graph.plot(vertex_color='red', edge_color='red', indices=True, ax=ax)
ax.set_title('graph and its line graph')

line_graph

Todo:

Should be consistent with NetworkX's line_graph.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.07%) to 88.13% when pulling cf8f988c4074d3481fd820eea28c3471e1103fbc on line-graph into 8ce5bde39206129287375af24fdbcd7edddca8c5 on master.

nperraud commented 5 years ago

For the edge weight, I think we should think about the properties we want the graph to have. So let us do some math. For now we could raise a warning if the original graph is weighted.

mdeff commented 5 years ago

Agreed. Warning added. For now, it creates a binary line graph in all cases (as if the original graph was unweighted).

nperraud commented 5 years ago

This looks fine for me...