mirror of
https://github.com/gonum/gonum.git
synced 2025-10-06 07:37:03 +08:00
graph: change Edge interface to include ID method
This is to allow future handling of multigraphs.
This commit is contained in:
@@ -4,15 +4,18 @@
|
||||
|
||||
package graph
|
||||
|
||||
// Node is a graph node. It returns a graph-unique integer ID.
|
||||
// Node is a graph node. It returns a graph-unique integer node ID.
|
||||
type Node interface {
|
||||
ID() int64
|
||||
}
|
||||
|
||||
// Edge is a graph edge. In directed graphs, the direction of the
|
||||
// edge is given from -> to, otherwise the edge is semantically
|
||||
// unordered.
|
||||
// unordered. An Edge returns an ID which must be graph-unique
|
||||
// integer edge ID if the containing graph is a multigraph, otherwise
|
||||
// no constraint exists on ID values.
|
||||
type Edge interface {
|
||||
ID() int64
|
||||
From() Node
|
||||
To() Node
|
||||
}
|
||||
|
Reference in New Issue
Block a user