Class

quiver

Graph

Related Doc: package quiver

Permalink

case class Graph[N, A, B](rep: GraphRep[N, A, B]) extends Product with Serializable

An implementation of an inductive graph where nodes of type N are labeled with A, and edges are labeled with B.

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. Graph
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Graph(rep: GraphRep[N, A, B])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def &(ctx: Context[N, A, B]): Graph[N, A, B]

    Permalink

    Alias for embed

  4. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Graph[N, A, B] to any2stringadd[Graph[N, A, B]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  5. def ->[B](y: B): (Graph[N, A, B], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Graph[N, A, B] to ArrowAssoc[Graph[N, A, B]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  7. def addEdge(e: LEdge[N, B]): Graph[N, A, B]

    Permalink

    Add an edge to this graph.

    Add an edge to this graph. Throws an error if the source and target nodes don't exist in the graph.

  8. def addEdges(es: Seq[LEdge[N, B]]): Graph[N, A, B]

    Permalink

    Add multiple edges to this graph

  9. def addNode(n: LNode[N, A]): Graph[N, A, B]

    Permalink

    Add a node to this graph.

    Add a node to this graph. If this node already exists with a different label, its label will be replaced with this new one.

  10. def addNodes(vs: Seq[LNode[N, A]]): Graph[N, A, B]

    Permalink

    Add multiple nodes to this graph

  11. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  12. def bf(q: Queue[Path[N]]): RTree[N]

    Permalink

    Utility function for breadth-first search trees.

  13. def bfe(v: N): Seq[Edge[N]]

    Permalink

    Breadth-first search remembering predecessor information.

    Breadth-first search remembering predecessor information. Gives transient edges in breadth-first order, starting from the given node.

  14. def bfen(es: Seq[Edge[N]]): Seq[Edge[N]]

    Permalink

    Breadth-first search remembering predecessor information.

    Breadth-first search remembering predecessor information. Gives transient edges starting from the targets of the given edges, in breadth-first order.

  15. def bfenInternal(q: Queue[Edge[N]]): Vector[Edge[N]]

    Permalink

    Utility function for breadth-first search, remembering predecessor information.

  16. def bfs(v: N): Seq[N]

    Permalink

    Breadth-first search from the given node.

    Breadth-first search from the given node. The result is ordered by distance from the node v.

  17. def bfsWith[C](f: (Context[N, A, B]) ⇒ C, v: N): Seq[C]

    Permalink

    Breadth-first search from the given node.

    Breadth-first search from the given node. The result is a vector of results of passing the context of each visited to the function f.

  18. def bfsn(vs: Seq[N]): Seq[N]

    Permalink

    Breadth-first search from the given nodes.

    Breadth-first search from the given nodes. The result is the successors of vs, with immediate successors first.

  19. def bfsnInternal[C](f: (Context[N, A, B]) ⇒ C, q: Queue[N]): Vector[C]

    Permalink

    Utility function for breadth-first search (nodes ordered by distance)

  20. def bfsnWith[C](f: (Context[N, A, B]) ⇒ C, vs: Seq[N]): Seq[C]

    Permalink

    Breadth-first search from the given nodes.

    Breadth-first search from the given nodes. The result is a vector of results of passing the context of each visited node to the function f.

  21. def bft(v: N): RTree[N]

    Permalink

    Breadth-first search tree.

    Breadth-first search tree. The result is a list of paths through the graph from the given vertex, in breadth-first order.

  22. def bidecomp(first: N, last: N): Option[BiDecomp[N, A, B]]

    Permalink

    Returns a context focused on two nodes designated "first" and "last", if present, and the graph with those nodes removed.

  23. def cheapestPath[C](s: N, t: N, costFkt: (LNode[N, A], B, LNode[N, A]) ⇒ C)(implicit arg0: Monoid[C], arg1: Ordering[C]): Option[LPath[N, B]]

    Permalink

    Cheapest path from vertex s to vertex t under the cost function costFkt with labels

  24. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. def contains(v: N): Boolean

    Permalink

    Returns true if the given node is in the graph, otherwise false

  26. def context(v: N): Context[N, A, B]

    Permalink

    Find the context for the given node.

    Find the context for the given node. Causes an error if the node is not present in the graph.

  27. def contextGraph: Graph[N, Context[N, A, B], B]

    Permalink

    Get all the contexts of this graph, as a graph.

  28. def contexts: Vector[Context[N, A, B]]

    Permalink

    Get all the contexts in the graph, as a vector.

    Get all the contexts in the graph, as a vector. Note that the resulting contexts may overlap, in the sense that successive contexts in the result will contain vertices from previous contexts as well.

  29. def countNodes: Int

    Permalink

    The number of nodes in this graph

  30. def decomp(n: N): Decomp[N, A, B]

    Permalink

    Returns a context focused on the given node, if present, and the graph with that node removed.

  31. def decompAny: Decomp[N, A, B]

    Permalink

    Decompose this graph into the context for an arbitrarily chosen node and the rest of the graph.

  32. def degree(v: N): Int

    Permalink

    The number of connections to and from the given node

  33. def dfs(vs: Seq[N]): Seq[N]

    Permalink

    Forward depth-first search.

  34. def dfsWith[C](vs: Seq[N], f: (Context[N, A, B]) ⇒ C): Seq[C]

    Permalink

    Forward depth-first search.

  35. def edges: Vector[Edge[N]]

    Permalink

    A list of all the edges in the graph

  36. def efilter(f: (LEdge[N, B]) ⇒ Boolean): Graph[N, A, B]

    Permalink

    The subgraph containing only edges that match the property

  37. def elfilter(f: (B) ⇒ Boolean): Graph[N, A, B]

    Permalink

    The subgraph containing only edges whose labels match the property

  38. def emap[C](f: (B) ⇒ C): Graph[N, A, C]

    Permalink

    Map a function over the edge labels in the graph

  39. def embed(ctx: Context[N, A, B]): Graph[N, A, B]

    Permalink

    Embed the given context in the graph.

    Embed the given context in the graph. If the context's vertex is already in the graph, removes the old context from the graph first. This operation is the deterministic inverse of decomp and obeys the following laws:

    (g & c) decomp c.vertex == Decomp(Some(c), g) (g decomp c.vertex).rest & c == (g & c)

  40. def endBy(f: (Graph[N, A, B], N) ⇒ Seq[N]): Seq[N]

    Permalink

    Find all nodes that match the given ending criteria.

  41. def endNode(f: (Graph[N, A, B], N) ⇒ Seq[N], n: N): Boolean

    Permalink

    Check if the given node is an end node according to the given criteria.

    Check if the given node is an end node according to the given criteria. An ending node n in graph g has f(g,n) containing no nodes other than n.

  42. def ensuring(cond: (Graph[N, A, B]) ⇒ Boolean, msg: ⇒ Any): Graph[N, A, B]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Graph[N, A, B] to Ensuring[Graph[N, A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  43. def ensuring(cond: (Graph[N, A, B]) ⇒ Boolean): Graph[N, A, B]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Graph[N, A, B] to Ensuring[Graph[N, A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  44. def ensuring(cond: Boolean, msg: ⇒ Any): Graph[N, A, B]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Graph[N, A, B] to Ensuring[Graph[N, A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  45. def ensuring(cond: Boolean): Graph[N, A, B]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Graph[N, A, B] to Ensuring[Graph[N, A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  46. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  47. def esp(s: N, t: N): Option[Path[N]]

    Permalink

    The shortest path from vertex s to vertex t

  48. def filterMap[C, D](f: (Context[N, A, B]) ⇒ Option[Context[N, C, D]]): Graph[N, C, D]

    Permalink

    Build a graph out of a partial map of the contexts in this graph.

  49. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  50. def findEdge(e: Edge[N]): Option[LEdge[N, B]]

    Permalink

    Find an edge between two nodes

  51. def fold[C](u: C)(f: (Context[N, A, B], C) ⇒ C): C

    Permalink

    Fold a function over the graph.

    Fold a function over the graph. Note that each successive context received by the function will not contain vertices at the focus of previously received contexts. The first context will be an arbitrarily chosen context of this graph, but the next context will be arbitrarily chosen from a graph with the first context removed, and so on.

  52. def foldAll[C](u: C)(f: (Context[N, A, B], C) ⇒ C): C

    Permalink

    Fold a function over all the contexts in the graph.

    Fold a function over all the contexts in the graph. Each context received by the function will be an arbitrarily chosen context of this graph. Contrary to fold, this visits every node of the graph and gives you all incoming and outgoing adjacencies for each node.

  53. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Graph[N, A, B] to StringFormat[Graph[N, A, B]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  54. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  55. def gmap[C, D](f: (Context[N, A, B]) ⇒ Context[N, C, D]): Graph[N, C, D]

    Permalink

    Map a function over the graph

  56. def hasLoop: Boolean

    Permalink

    Check if this graph has any loops, which connect a node to itself.

  57. def hasMulti: Boolean

    Permalink

    Check if this graph has multiple edges connecting any two nodes

  58. def inDegree(v: N): Int

    Permalink

    The number of inbound edges from the given node

  59. def inEdges(v: N): Vector[LEdge[N, B]]

    Permalink

    Find all inbound edges for the given node

  60. def ins(v: N): Adj[N, B]

    Permalink

    All the inbound links of the given node, including self-edges

  61. def isEmpty: Boolean

    Permalink

    Check if the graph is empty

  62. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  63. def isLeaf(n: N): Boolean

    Permalink

    Check if the given node is a leaf of this graph

  64. def isRoot(n: N): Boolean

    Permalink

    Check if the given node is a root of this graph

  65. def isSimple: Boolean

    Permalink

    Check whether this graph is simple.

    Check whether this graph is simple. A simple graph has no loops and no multi-edges.

  66. def labEdges: Vector[LEdge[N, B]]

    Permalink

    A list of all the edges in the graph and their labels

  67. def labNodes: Vector[LNode[N, A]]

    Permalink

    A list of all the nodes in the graph and their labels

  68. def label(v: N): Option[A]

    Permalink

    Find the label for a node

  69. def labfilter(p: (A) ⇒ Boolean): Graph[N, A, B]

    Permalink

    The subgraph containing only nodes whose labels match the property

  70. def labnfilter(p: (LNode[N, A]) ⇒ Boolean): Graph[N, A, B]

    Permalink

    The subgraph containing only labelled nodes that match the property

  71. def lbf(q: Queue[LPath[N, B]]): LRTree[N, B]

    Permalink

    Utility function for labeled breadth-first search tree

  72. def lbft(v: N): LRTree[N, B]

    Permalink

    Breadth-first search tree with labeled paths

  73. def leaves: Set[N]

    Permalink

    Find the leaves of the graph.

    Find the leaves of the graph. A leaf is a node which as no outgoing edges.

  74. def lesp(s: N, t: N): Option[LPath[N, B]]

    Permalink

    Shortest path from vertex s to vertex t, with labels

  75. def level(v: N): Seq[(N, Int)]

    Permalink

    Breadth-first search giving the distance of each node from the node v.

  76. def leveln(vs: Seq[(N, Int)]): Seq[(N, Int)]

    Permalink

    Breadth-first search giving the distance of each node from the search nodes.

  77. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  78. def neighbors(v: N): Vector[N]

    Permalink

    Find the neighbors of a node

  79. def nfilter(p: (N) ⇒ Boolean): Graph[N, A, B]

    Permalink

    The subgraph containing only nodes that match the property

  80. def nmap[C](f: (A) ⇒ C): Graph[N, C, B]

    Permalink

    Map a function over the node labels in the graph

  81. def nodes: Vector[N]

    Permalink

    A list of all the nodes in the graph

  82. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  83. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  84. def outDegree(v: N): Int

    Permalink

    The number of outbound edges from the given node

  85. def outEdges(v: N): Vector[LEdge[N, B]]

    Permalink

    Find all outbound edges for the given node

  86. def outs(v: N): Adj[N, B]

    Permalink

    All the outbound links of the given node, including self-edges

  87. def predecessors(v: N): Vector[N]

    Permalink

    Find all nodes that have a link to the given node

  88. def rdfs(vs: Seq[N]): Seq[N]

    Permalink

    Reverse depth-first search.

    Reverse depth-first search. Follows predecessors.

  89. def redecorate[C](f: (Context[N, A, B]) ⇒ C): Graph[N, C, B]

    Permalink

    Map a function over the contexts of this graph, and put the results in the labels.

  90. def removeEdge(e: Edge[N]): Graph[N, A, B]

    Permalink

    Remove an edge from this graph

  91. def removeEdges(es: Seq[Edge[N]]): Graph[N, A, B]

    Permalink

    Remove multiple edges from this graph

  92. def removeLEdge(e: LEdge[N, B]): Graph[N, A, B]

    Permalink

    Remove an edge from this graph only if the label matches

  93. def removeNode(v: N): Graph[N, A, B]

    Permalink

    Remove a node from this graph

  94. def removeNodes(vs: Seq[N]): Graph[N, A, B]

    Permalink

    Remove multiple nodes from this graph

  95. val rep: GraphRep[N, A, B]

    Permalink
  96. def reverse: Graph[N, A, B]

    Permalink

    Reverse the direction of all edges

  97. def roots: Set[N]

    Permalink

    Find the roots of the graph.

    Find the roots of the graph. A root is a node which has no incoming edges.

  98. def safeAddEdge(e: LEdge[N, B], failover: ⇒ Graph[N, A, B] = this): Graph[N, A, B]

    Permalink

    Add an edge to this graph.

    Add an edge to this graph. If the source and target nodes don't exist in this graph, return the given failover graph.

  99. def safeAddEdges(es: Seq[LEdge[N, B]]): Graph[N, A, B]

    Permalink

    Add multiple edges to this graph, ignoring edges whose source and target nodes don't already exist in the graph.

  100. def select(p: (Context[N, A, B]) ⇒ Boolean): Vector[Context[N, A, B]]

    Permalink

    Project out (non-overlapping) contexts for which the given property is true.

    Project out (non-overlapping) contexts for which the given property is true. Note that the contexts will not overlap, in the sense that successive contexts in the result will not contain the vertices at the focus of previous contexts.

  101. def selectAll(p: (Context[N, A, B]) ⇒ Boolean): Vector[Context[N, A, B]]

    Permalink

    Get all the contexts for which the given property is true.

    Get all the contexts for which the given property is true. Note that the resulting contexts may overlap, in the sense that successive contexts in the result may contain vertices from previous contexts.

  102. def subgraph(vs: Seq[N]): Graph[N, A, B]

    Permalink

    The subgraph containing only the given nodes

  103. def successors(v: N): Vector[N]

    Permalink

    Find all nodes that have a link from the given node

  104. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  105. def toString(): String

    Permalink
    Definition Classes
    Graph → AnyRef → Any
  106. def udfs(vs: Seq[N]): Seq[N]

    Permalink

    Undirected depth-first search

  107. def undir: Graph[N, A, B]

    Permalink

    Make the graph undirected, ensuring that every edge has an inverse.

    Make the graph undirected, ensuring that every edge has an inverse. This takes edge labels into account when considering whether two edges are equal.

  108. def union(g: Graph[N, A, B]): Graph[N, A, B]

    Permalink

    Adds all the nodes and edges from one graph to another.

  109. def unlabel: Graph[N, Unit, Unit]

    Permalink

    Erase all labels in the graph

  110. def updateEdge(e: LEdge[N, B]): Graph[N, A, B]

    Permalink

    Replace an edge with a new one

  111. def updateEdges(es: Seq[LEdge[N, B]]): Graph[N, A, B]

    Permalink

    Update multiple edges

  112. def updateNode(n: LNode[N, A]): Graph[N, A, B]

    Permalink

    Replace a node with a new one

  113. def updateNodes(ns: Seq[LNode[N, A]]): Graph[N, A, B]

    Permalink

    Update multiple nodes

  114. def vmap[M](f: (N) ⇒ M): Graph[M, A, B]

    Permalink

    Map over the unique node identifiers in the graph

  115. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  116. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  117. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  118. final def xdfsWith[C](vs: Seq[N], d: (Context[N, A, B]) ⇒ Seq[N], f: (Context[N, A, B]) ⇒ C): Vector[C]

    Permalink

    Generalized depth-first search.

  119. def [B](y: B): (Graph[N, A, B], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Graph[N, A, B] to ArrowAssoc[Graph[N, A, B]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Graph[N, A, B] to any2stringadd[Graph[N, A, B]]

Inherited by implicit conversion StringFormat from Graph[N, A, B] to StringFormat[Graph[N, A, B]]

Inherited by implicit conversion Ensuring from Graph[N, A, B] to Ensuring[Graph[N, A, B]]

Inherited by implicit conversion ArrowAssoc from Graph[N, A, B] to ArrowAssoc[Graph[N, A, B]]

Basic Graph Operations

Graph Decomposition

Structural decomposition of a graph

Graph Composition

Deletion and Modification

Projection

Functions for extracting global information about a graph

Graph Inspection

Functions for extracting information about individual nodes and edges in a graph

Folds and Maps

Subgraphs

Depth-First Search

Algorithms for depth-first traversal.

Breadth-First Search

Algorithms for breadth-first traversal.

Roots and Leaves

Queries to find starting and ending nodes, roots, and leaves.

Graph Classification

Classification functions on graphs

Ungrouped