class Graph[TLabel] extends Cloneable
The Graph
class stores vertex-labeled directed graphs using an adjacency
set 'ch' representation, e.g., 'ch = { {1, 2}, {0}, {1} }' means that the
graph has the following edges { (0, 1), (0, 2), (1, 0), (2, 1) }.
Optionally, inverse adjacency via the 'pa' array can be stored at the cost
of nearly doubling the storage requirements.
----------------------------------------------------------------------------
- Alphabetic
- By Inheritance
- Graph
- Cloneable
- Cloneable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Graph(ch: Array[Set[Int]], label: Array[TLabel] = Array.ofDim (0), inverse: Boolean = false, name: String = "g", vid: Array[Int] = null)(implicit arg0: ClassTag[TLabel])
- ch
the array of child (adjacency) vertex sets (outgoing edges)
- label
the array of vertex labels
- inverse
whether to store inverse adjacency sets (parents)
- name
the name of the digraph
- vid
the vertex id (facilitates partitioning)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addPar(): Unit
Add the inverse adjacency sets for rapid accesses to parent vertices.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
buildLabelMap(label: Array[TLabel]): Map[TLabel, Set[Int]]
Given an array of labels, return an index from labels to the sets of vertices containing those labels.
Given an array of labels, return an index from labels to the sets of vertices containing those labels.
- label
the array of vertex labels of type
TLabel
- val ch: Array[Set[Int]]
-
def
checkEdges: Boolean
Check whether the end-point vertex id of each edge is within bounds: '0 ..
Check whether the end-point vertex id of each edge is within bounds: '0 .. maxId'.
-
def
clone(): Graph[TLabel]
Clone (make a deep copy) of 'this' digraph.
Clone (make a deep copy) of 'this' digraph.
- Definition Classes
- Graph → AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getVerticesWithLabel(l: TLabel): Equals
Return the set of vertices in 'this' digraph with label 'l'.
Return the set of vertices in 'this' digraph with label 'l'.
- l
the label to match
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- var inverse: Boolean
-
def
isConnected: Boolean
Determine whether 'this' digraph is (weakly) connected.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val label: Array[TLabel]
-
val
labelMap: Map[TLabel, Set[Int]]
The map from label to the set of vertices with the label
-
def
makeUndirected(): Graph[TLabel]
Make this directed graph work like an undirected graph by making sure that for every edge 'u -> v', there is a 'v -> u' edge.
-
def
nEdges: Int
Return the number of edges in 'this' digraph.
-
def
nSelfLoops: Int
Determine the number of vertices in the digraph that have outgoing edges to themselves.
- val name: String
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
val
pa: Array[Set[Int]]
The optional array of vertex inverse (parent) adjacency sets (incoming edges)
-
def
printG(clip: Boolean = true): Unit
Print 'this' digraph in a deep sense with all the information.
Print 'this' digraph in a deep sense with all the information.
- clip
whether to clip out "Set(" and ")"
-
def
same(g: Graph[TLabel]): Boolean
Determine whether 'this' digraph and digraph 'g' have the same vertices and edges.
Determine whether 'this' digraph and digraph 'g' have the same vertices and edges. Note, this is more strict than graph isomorphism which allows vertices to be renumbered.
- g
the other digraph
-
def
size: Int
Return the number of vertices in 'this' digraph.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toGraphIm(name2: String = name): graphalytics.Graph
Return the equivalent immutable Graph.
Return the equivalent immutable Graph. Assumes the default
TLabel
of typeString
. For other types (e.g.,Double
use '_.toDouble' rather than '.toString' in the last line of this method.- name2
the name to give the new immutable Graph
- See also
scalation.graphalytics.Graph
-
def
toLine(i: Int, clip: Boolean = true): String
Convert the 'i'th row/line of 'this' digraph to a string.
Convert the 'i'th row/line of 'this' digraph to a string.
- i
the 'i'th row/line
- clip
whether to clip out "Set(" and ")"
-
def
toString(): String
Convert 'this' digraph to a string in a shallow sense.
Convert 'this' digraph to a string in a shallow sense. Large arrays are not converted. Use 'print' to show all information.
- Definition Classes
- Graph → AnyRef → Any
-
def
union(g2: Graph[TLabel]): Graph[TLabel]
Take the union 'this' digraph and 'g2'.
Take the union 'this' digraph and 'g2'.
- g2
the other digraph
- val vid: Array[Int]
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )