Traverses in FIFO (breadth first) order but without any limit on the number of times every node can be visited.
This class is an implementation of the directed graph trait that is backed by an array The private constructor takes as its input a list of (@see Node) nodes, then stores nodes in an array.
This class is an implementation of the directed graph trait that is backed by an array The private constructor takes as its input a list of (@see Node) nodes, then stores nodes in an array. It also builds all edges which are also stored in array.
A dynamic directed graph, implemented using an ArrayBuffer of IntArrayList (from the fastutil library).
A dynamic directed graph, implemented using an ArrayBuffer of IntArrayList (from the fastutil library). If n nodes are used, O(n) objects are created, independent of the number of edges.
For efficiency, it's recommended that ids be sequentially numbered, as an internal array is stored which is longer than the maximum id seen.
This class is not threadsafe. If multiple thread access it simultaneously and at least one mutates it, synchronization should be used. Currently no new threads are created by this class (all operations execute on a single thread).
Bounds an iterator to go no more than a specified maximum number of steps
Traverses in BFS order.
Traverses in BFS order. This implies that first all the neighbors of
homeNodeIds
are visited, then their neighbors, etc.
An efficient dynamic graph implementation which supports concurrent reading and writing.
An efficient dynamic graph implementation which supports concurrent reading and writing. Reads happen without locks or data copying. Nodes are stored in a ConcurrentHashMap, and neighbors of each node are stored in Array[Int]s. Currently, only edge and node addition (not deletion) is supported.
Traverses in DFS order (every node can be visited only once).
A traverser that keeps track of first depth of visiting a given node.
The entry point into a model of a directed graph.
The entry point into a model of a directed graph. Users typically query a known starting node
and then traverse the graph using methods on that Node
.
This class contains some common utilities and convenience functions for directed graphs.
This class contains some common utilities and convenience functions for directed graphs.
It differs from GraphUtils
because it works on a directed graph (which provides
some other things, such as an iterator on top of the underlying Graph
)
Represents a directed path of nodes in a graph.
Represents a directed path of nodes in a graph. No loop detection is done.
Represents a collection of directed paths.
Represents a collection of directed paths. For example, a collection of paths out of the same source node.
Trait to be mixed in to the BFS/DFS traverser to add discovery and finishing times of a node.
Trait to be mixed in to the BFS/DFS traverser to add discovery and finishing times of a node.
Discovery time of a node is time when the node is added to the queue for the first time.
Finishing time of a node is time just after all dir
neighbors of the node became finished
(or when it is visited if it has no dir
neighbors that should be processed later).
A class support dynamically adds new nodes and dynamically add/delete edges in existing nodes.
A class support dynamically adds new nodes and dynamically add/delete edges in existing nodes. It currently doesn't support delete nodes
A class supporting dynamic addition of new nodes and addition/deletion of edges in existing nodes.
A class supporting dynamic addition of new nodes and addition/deletion of edges in existing nodes. It currently doesn't support deletion of nodes.
The entry point into a model of a graph.
The entry point into a model of a graph. Users typically query a known starting node
and then traverse the graph using methods on that Node
.
This class contains some common graph utilities and convenience functions.
A graph which reads edge data from a memory mapped file.
A graph which reads edge data from a memory mapped file. There is no object overhead per node: the memory used for n nodes and m edges with both in-neighbor and out-neighbor access is exactly 16 + 16*n + 8*m bytes. Also, loading is very fast because no parsing of text is required. Loading time is exactly the time it takes the operating system to map data from disk into memory. Nodes are numbered sequentially from 0 to nodeCount - 1 and must be a range of this form (i.e. nodeCount == maxNodeId + 1).
When transforming a graph where nodeCount <= maxNodeId to this format, new nodes with no neighbors will be implicitly created. Currently only supports storing both in-neighbors and out-neighbors of nodes (StoredGraphDir.BothInOut). The binary format is currently subject to change. Node objects are created on demand when getNodeById is called.
Constructor for a default node with neighbors stored as Arrays.
Constructor for a default node with neighbors stored as CSeqs.
Represents a node in a directed graph.
This case class holds a node's id, all its out edges, and the max id of itself and ids of nodes in its out edges
A trait to be mixed in to the DepthFirstTraverser that keeps track of visiting distance
from homeNodeIds
.
A trait to be mixed in to the DepthFirstTraverser that keeps track of visiting distance
from homeNodeIds
.
Note that DepthTracker for the DFS case returns the depth of first seeing a particular node. It does not have to be the same as the depth at which the node is visited.
General schema for some Traversers (like BFS, DFS).
General schema for some Traversers (like BFS, DFS).
QueueBasedTraverser
keeps nodes to visit next in a queue.
It iteratively visits nodes from the front of the queue in order based on the type of traversal
and optionally adds new nodes to the queue.
Same as RandomTraverser except that the number of steps taken is bounded by maxSteps
Randomly traverse the graph, going from one node to a random neighbor in direction dir
.
This class is an implementation of the directed graph trait that is backed by a sharded 2-dimensional edges array.
This class is an implementation of the directed graph trait that is backed by a sharded 2-dimensional edges array. Each node's edges are stored consecutively in one shard of the edge array. Number of shard is usually much smaller than number of nodes.
Contains meta-information about a particular graph instance.
Contains meta-information about a particular graph instance.
the max node id in the graph
the number of edges in the graph
This trait designed to be mixed in to Node
when neighbors of node
are sorted Arrays.
A class support dynamically adds new nodes and dynamically add/delete edges in existing nodes.
A class support dynamically adds new nodes and dynamically add/delete edges in existing nodes. It currently doesn't support delete nodes
A simple implementation of a DirectedGraph
A Traverser traverses the graph in a certain order of nodes.
A representation of the two directions edges point in a directed graph.
ArrayBasedDirectedGraph can be stored with neighbors sorted or not.
ArrayBasedDirectedGraph can be stored with neighbors sorted or not. Therefore there
are 3 strategies of loading a graph from input:
AlreadySorted
- creates a graph with sorted neighbors from sorted input
SortWhileReading
- creates a graph with sorted neighbors sorting them
while reading
LeaveUnsorted
- creates graph with unsorted neighbors (default)
This class contains common graph node based utilities and convenience functions.
This class contains common graph node based utilities and convenience functions.
In general, only utilities that are local to a node are kept here. Utility methods
that touch many nodes are found in GraphUtils
.
Some sample graphs for quick testing in tests.
Traverses in FIFO (breadth first) order but without any limit on the number of times every node can be visited. Every time the walk visits a node, it adds all its neighbors (along direction
dir
) to the queue.