Graph

org.encalmo.data.Graph
See theGraph companion trait
object Graph

Graph operations.

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Graph.type

Members list

Type members

Classlikes

trait DfsVisitor[N]

Depth-first search visitor.

Depth-first search visitor.

Attributes

Supertypes
class Object
trait Matchable
class Any
final class GenericGraphImpl[N](val nodes: Traversable[N], val adjacent: N => Traversable[N]) extends GenericGraph[N]

Generic graph implementation created from a nodes collection and an adjacent nodes function.

Generic graph implementation created from a nodes collection and an adjacent nodes function.

Attributes

Supertypes
trait GenericGraph[N]
trait Graph[N]
class Object
trait Matchable
class Any

Attributes

Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type
final class ReversedMutableMapGraph[N](_reverse: Graph[N]) extends MutableMapGraph[N]

Reversed mutable map graph implementation.

Reversed mutable map graph implementation.

Attributes

Supertypes
class MutableMapGraph[N]
trait Mutable[N]
trait Shrinkable[(N, N)]
trait Growable[(N, N)]
trait Clearable
trait GenericGraph[N]
trait Graph[N]
class Object
trait Matchable
class Any
Show all
final class WeightedGraphImpl[N, V](val nodes: Traversable[N], val adjacent: N => Traversable[N], val weight: (N, N) => V)(using evidence$1: Numeric[V]) extends GenericGraph[N], Weighted[N, V]

Weighted graph implementation created from a nodes collection, an adjacent nodes function, and a weight function.

Weighted graph implementation created from a nodes collection, an adjacent nodes function, and a weight function.

Attributes

Supertypes
trait Weighted[N, V]
trait GenericGraph[N]
trait Graph[N]
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def apply[N](): MutableMapGraph[N]
inline def apply[N](map: Map[N, Traversable[N]]): MapGraph[N]

Create a map graph from a given map of nodes to adjacent nodes.

Create a map graph from a given map of nodes to adjacent nodes.

Attributes

inline def apply[N](mappings: (N, Traversable[N])*): MapGraph[N]

Create a map graph from a given sequence of nodes and adjacent nodes.

Create a map graph from a given sequence of nodes and adjacent nodes.

Attributes

inline def apply[N](nodes: Iterable[N], adjacent: N => Traversable[N]): Graph[N]

Create a generic graph from a given nodes collection and an adjacent nodes function.

Create a generic graph from a given nodes collection and an adjacent nodes function.

Attributes

inline def apply[N](edges: Traversable[(N, N)]): MutableMapGraph[N]

Create a mutable map graph from a given sequence of edges.

Create a mutable map graph from a given sequence of edges.

Attributes

inline def apply[N](edges: Iterator[(N, N)]): MutableMapGraph[N]

Create a mutable map graph from a given iterator of edges.

Create a mutable map graph from a given iterator of edges.

Attributes

def apply[N, V : Numeric](mappings: (N, Iterable[(N, V)])*): Graph[N] & Weighted[N, V]

Create a weighted graph from a given sequence of nodes and adjacent nodes with weights.

Create a weighted graph from a given sequence of nodes and adjacent nodes with weights.

Attributes

inline def hardCopy[N](graph: Graph[N]): MutableMapGraph[N]

Create a mutable map graph from a given graph.

Create a mutable map graph from a given graph.

Attributes

inline def hardCopyReversed[N](graph: Graph[N]): MutableMapGraph[N]

Create a reversed mutable map graph from a given graph.

Create a reversed mutable map graph from a given graph.

Attributes

Read a graph from a given adjacent list file.

Read a graph from a given adjacent list file.

Attributes

Read a weighted graph from a given adjacent weight list file.

Read a weighted graph from a given adjacent weight list file.

Attributes

def readFromEdgeListFile(path: Source, reversed: Boolean = ...): Graph[Int]

Read a graph from a given edge list file.

Read a graph from a given edge list file.

Attributes

Extensions

Extensions

extension [N](graph: Graph[N])
def bfs(visitor: N => Unit): Unit

Breath-first search of the whole graph

Breath-first search of the whole graph

Attributes

def bfs(node: N, visitor: N => Unit, explored: HashSet[N] = ...): Unit

Breath-first search of the graph starting at given node

Breath-first search of the graph starting at given node

Attributes

inline def dfs(visitor: DfsVisitor[N]): Unit

Depth-first search of the whole graph

Depth-first search of the whole graph

Attributes

def dfs(visitor: DfsVisitor[N], nodes: Traversable[N]): Unit

Depth-first search of the whole graph in the given node's order

Depth-first search of the whole graph in the given node's order

Attributes

def dfs(node: N, visitor: DfsVisitor[N], explored: HashSet[N] = ...): Unit

Depth-first search (recursive) of the graph starting at given node

Depth-first search (recursive) of the graph starting at given node

Attributes

def dfsi(source: N, visitor: DfsVisitor[N], explored: HashSet[N] = ...): Unit

Depth-first search (iterative) of the graph starting at given node

Depth-first search (iterative) of the graph starting at given node

Attributes

def findCycles: Vector[N]

Find cycles in the graph.

Find cycles in the graph.

Attributes

def findCycles(node: N, marks: Map[N, Char] = ...): Vector[N]

Find cycles in the graph starting at given node.

Find cycles in the graph starting at given node.

Attributes

Check if the graph has cycles.

Check if the graph has cycles.

Attributes

def merge(graph2: Graph[N]): Graph[N]

Merges two graphs without duplicating existing nodes

Merges two graphs without duplicating existing nodes

Attributes

def mergeNodes(mergedNode: N, removedNode: N): MutableMapGraph[N]

Merge two nodes in the mutable map graph.

Merge two nodes in the mutable map graph.

Attributes

Returns a new graph containing only all the transitive predecessors and successors of the given node.

Returns a new graph containing only all the transitive predecessors and successors of the given node.

Attributes

def predecessorsAndSuccessorsOf(nodes: N*): Graph[N]

Returns a new graph containing only all the transitive predecessors and successors of the given nodes.

Returns a new graph containing only all the transitive predecessors and successors of the given nodes.

Attributes

def predecessorsOf(node: N): Graph[N]

Returns a new graph containing only all the transitive predecessors of the given node.

Returns a new graph containing only all the transitive predecessors of the given node.

Attributes

def predecessorsOf(nodes: N*): Graph[N]

Returns a new graph containing only all the transitive predecessors of the given nodes.

Returns a new graph containing only all the transitive predecessors of the given nodes.

Attributes

Count the number of random cuts in the graph.

Count the number of random cuts in the graph.

Attributes

Sort the graph topologically.

Sort the graph topologically.

Attributes

def successorsOf(node: N): Graph[N]

Returns a new graph containing only all the transitive successors of the given node.

Returns a new graph containing only all the transitive successors of the given node.

Attributes

def successorsOf(nodes: N*): Graph[N]

Returns a new graph containing only all the transitive successors of the given nodes.

Returns a new graph containing only all the transitive successors of the given nodes.

Attributes

extension [N, V : Numeric](graph: Graph[N] & Weighted[N, V])
inline def findShortestPath(from: N, to: N): (V, List[(N, N)])

Dijkstra algorithm finds shortest path in directed graph

Dijkstra algorithm finds shortest path in directed graph

Attributes

def findShortestPath(from: N, to: N, weight: (N, N) => V): (V, List[(N, N)])

Dijkstra algorithm finds the shortest path in a directed graph

Dijkstra algorithm finds the shortest path in a directed graph

Attributes

inline def findShortestPaths(from: N): Map[N, V]

Dijkstra algorithm finds all shortest paths starting at given node in directed graph

Dijkstra algorithm finds all shortest paths starting at given node in directed graph

Attributes

def findShortestPaths(from: N, weight: (N, N) => V): Map[N, V]

Dijkstra algorithm finds all shortest paths starting at given node in directed graph

Dijkstra algorithm finds all shortest paths starting at given node in directed graph

Attributes