| layout | default | |||||||
|---|---|---|---|---|---|---|---|---|
| title | Properties | |||||||
| nav_order | 4 | |||||||
| menu_toc |
|
All the following properties are read-only and may not be changed by the user.
Number of nodes in the graph.
Example
const graph = new Graph();
graph.addNode('John');
graph.addNode('Jack');
graph.order;
>>> 2Number of edges in the graph.
Example
const graph = new Graph();
graph.addNode('John');
graph.addNode('Jack');
graph.addEdge('John', 'Jack');
graph.size;
>>> 1Variants
#.directedSize#.undirectedSize
Type of the graph. One of mixed, directed or undirected.
Example
const graph = new Graph();
graph.type;
>>> 'mixed'
const directedGraph = new DirectedGraph();
directedGraph.type;
>>> 'directed'Whether the graph accepts parallel edges or not.
Example
const graph = new Graph();
graph.multi;
>>> false
const multiGraph = new MultiGraph();
multiGraph.multi;
>>> trueWhether the graph accepts self loops or not.
const graph = new Graph();
graph.allowSelfLoops;
>>> true
const otherGraph = new Graph({allowSelfLoops: false});
graph.allowSelfLoops;
>>> falseThe total number of self loop included in the graph.
const graph = new Graph();
graph.selfLoopCount
>>> 0
graph.mergeEdge('John', 'John');
graph.selfLoopCount
>>> 1Variants
#.directedSelfLoopCount#.undirectedSelfLoopCount
A string containing the graph instance's implementation name.
import Graph from 'graphology';
const graph = new Graph();
graph.implementation;
>>> 'graphology'It can be useful if you ever need to optimize libraries based upon the knowledge that the given instance is from a specific implementation.