Skip to content

Commit b588fbe

Browse files
petercorkeclaude
andcommitted
feat: directed vertices record their incoming edges; degree is in plus out
A directed vertex now holds the edges that end at it as well as the ones that leave it, kept in step by _attach/_detach. That gives: - predecessors(), successors() (which is adjacent()), in_edges(), out_edges() - in_degree and out_degree - remove_vertex finding a vertex's edges from its own lists rather than scanning every edge in the graph (O(degree), was O(E)) - iscyclic taking in-degrees from the vertices (O(V), was O(E)) BREAKING, for a DGraph: degree is now the graph-theory degree, in plus out, so a self-loop counts 2 and the degrees of a graph sum to twice its edges. It counted only the edges leaving the vertex. This changes: vertex.degree (use out_degree for the old value) graph.degree() (np.diag([v.out_degree for v in g])) graph.connectivity() ([v.out_degree for v in g]) graph.average_degree() 2E/N, was E/N (g.ne / g.n) Laplacian() is unchanged: it is D_out - A, and now takes the out-degree explicitly instead of relying on degree(). For an undirected graph every quantity is as before. Each is documented with a versionchanged note, and a survey of RTB, MVTB and RVC3 found no caller of any of them on a DGraph. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 4025b10 commit b588fbe

4 files changed

Lines changed: 259 additions & 71 deletions

File tree

0 commit comments

Comments
 (0)