@graphty/graphty-element / extend / GraphView
Interface: GraphView ​
Defined in: graphty-element/src/simple/types.ts:107
The whole graph, as nodes and edges with real ids. Iteration order is stable: numeric ids ascending, then string ids in code-unit order (edges by edge id), the order compareNodeIds defines, so a result does not depend on the order records were loaded in.
Every array a view hands back (nodes(), edges(), and each node's neighbors(), edges() and directed forms) is frozen, built once per run and cached, so calling a method again inside a loop costs nothing.
Properties ​
directed ​
readonlydirected:boolean
Defined in: graphty-element/src/simple/types.ts:109
True when the definition asked for direction: "directed" and the graph has directed edges.
edgeCount ​
readonlyedgeCount:number
Defined in: graphty-element/src/simple/types.ts:113
How many edges the graph has, parallel edges and self-loops each counted.
nodeCount ​
readonlynodeCount:number
Defined in: graphty-element/src/simple/types.ts:111
How many nodes the graph has.
Methods ​
edge() ​
edge(
id):EdgeView|undefined
Defined in: graphty-element/src/simple/types.ts:121
The edge with this edge id, or undefined.
Parameters ​
id ​
string
Returns ​
EdgeView | undefined
edges() ​
edges(): readonly
EdgeView[]
Defined in: graphty-element/src/simple/types.ts:117
Every edge; parallel edges are separate edges, each with its own id.
Returns ​
readonly EdgeView[]
groupBy() ​
groupBy(
path):ReadonlyMap<string|number|boolean, readonlyNodeView[]>
Defined in: graphty-element/src/simple/types.ts:127
The nodes grouped by the value at path, each group in the view's order. Groups come in readable order: numbers ascending, then text in natural order ("2" before "10"). A node without the attribute is in no group; an undefined path gives an empty map.
Parameters ​
path ​
string | undefined
Returns ​
ReadonlyMap<string | number | boolean, readonly NodeView[]>
node() ​
node(
id):NodeView|undefined
Defined in: graphty-element/src/simple/types.ts:119
The node with this id, or undefined. The id is matched as the data spelled it: 0 and "0" are two nodes.
Parameters ​
id ​
Returns ​
NodeView | undefined
nodes() ​
nodes(): readonly
NodeView[]
Defined in: graphty-element/src/simple/types.ts:115
Every node, in the view's order.
Returns ​
readonly NodeView[]