public interface ObjectGraph<T>
| Modifier and Type | Method and Description |
|---|---|
List<Score<T>> |
apply(RankingAlgorithm<?> alg) |
Set<T> |
bottomLevelNodes()
Get the set of nodes which have no outbound edges.
|
List<T> |
byClosureSize()
Get a list of the nodes in the graph sorted by the size of their closure.
|
List<T> |
byReverseClosureSize()
Get a list of the nodes in the graph sorted by the size of their reverse
closure (all paths to the top of the graph from this node).
|
Set<T> |
children(T node)
Get the set of string node names which are immediate child nodes of a
given one (if the graph is cyclic, this may include the node name
passed).
|
Set<T> |
closureOf(T node)
Get the closure of this node in the graph - all nodes which are reachable
following outbound edges from this node and its descendants.
|
int |
closureSize(T node)
Determine the size of the closure of this node, following outbound edges
to the bottom of the graph, traversing each node once.
|
default Set<T> |
disjunctionOfClosureOfHighestRankedNodes()
This requires some explaining - it is used to pick the initial set of
colorings that are active - attempting to find nodes that are likely to
be ones someone would want flagged.
|
default int |
distance(T a,
T b)
Get the distance along the shortest path between two node.
|
Set<String> |
edgeStrings()
For logging convenience, get a list of strings that identify the edges
present in this graph.
|
default List<Score<T>> |
eigenvectorCentrality()
Compute the eigenvector centrality - "most likely to be connected
*through*" - score for each node.
|
int |
inboundReferenceCount(T node)
Count the number of nodes that have outbound edges to the passed node.
|
boolean |
isUnreferenced(T node)
Returns true if this node has no inbound edges.
|
ObjectGraph<T> |
omitting(Set<T> items)
Create a copy of this graph, omitting the passed set of
items.
|
int |
outboundReferenceCount(T node)
Count the number of nodes this node has outbound edges to.
|
default List<Score<T>> |
pageRank()
Compute the pagerank score of every node in the graph.
|
Set<T> |
parents(T node)
Get the set of strings which are immediate parent nodes to a given one
(if the graph is cyclic, this may include the node name passed).
|
List<ObjectPath<T>> |
pathsBetween(T a,
T b)
Get the set of paths that exist between two nodes.
|
Set<T> |
reverseClosureOf(T node)
Get the reverse closure of a node in the graph - all nodes which have an
outbound edge to this node, and all nodes which have an outbound edge to
one of those, and so forth, to the top of the graph.
|
int |
reverseClosureSize(T node)
Determine the size of the inverse closure of this node, following inbound
edges to the top of the graph, traversing each node once.
|
void |
save(ObjectOutput out)
Optimized serialization support.
|
int |
size()
Get the number of elements in this graph.
|
void |
toIntGraph(BiConsumer<com.mastfrog.abstractions.list.IndexedResolvable<? extends T>,IntGraph> consumer)
Convert this graph to its (usually internal) IntGraph, needed for
serialization.
|
T |
toNode(int index)
Get the node for an index.
|
int |
toNodeId(T node)
Get the integer id used internally for a node.
|
Set<T> |
topLevelOrOrphanNodes()
Get the set of nodes which have no inbound edges.
|
default void |
walk(ObjectGraphVisitor<? super T> v)
Walk the tree of nodes in some order, such that each node is only visited
once.
|
default void |
walk(T startingWith,
ObjectGraphVisitor<? super T> v)
Walk the tree of node definitions and node references in some order,
starting from the passed starting node.
|
default void |
walkUpwards(T startingWith,
ObjectGraphVisitor<? super T> v)
Walk the antecedents of a node.
|
List<T> byClosureSize()
List<T> byReverseClosureSize()
Set<String> edgeStrings()
Set<T> parents(T node)
node - A node nameSet<T> children(T node)
node - The node nameint inboundReferenceCount(T node)
node - The node nameint outboundReferenceCount(T node)
node - The node nameSet<T> topLevelOrOrphanNodes()
Set<T> bottomLevelNodes()
boolean isUnreferenced(T node)
node - A nodeint closureSize(T node)
node - A nodeint reverseClosureSize(T node)
node - Set<T> reverseClosureOf(T node)
node - A node nameSet<T> closureOf(T node)
node - A node namedefault void walk(ObjectGraphVisitor<? super T> v)
v - A visitordefault void walk(T startingWith, ObjectGraphVisitor<? super T> v)
startingWith - The starting nodev - A visitordefault void walkUpwards(T startingWith, ObjectGraphVisitor<? super T> v)
startingWith - The starting nodev - A visitordefault int distance(T a, T b)
a - One nodeb - Another nodedefault List<Score<T>> eigenvectorCentrality()
default List<Score<T>> pageRank()
default Set<T> disjunctionOfClosureOfHighestRankedNodes()
void save(ObjectOutput out) throws IOException
out - The outputIOException - If something goes wrongint toNodeId(T node)
node - A nodeT toNode(int index)
index - The indexList<Score<T>> apply(RankingAlgorithm<?> alg)
List<ObjectPath<T>> pathsBetween(T a, T b)
a - A first nodeb - A second nodevoid toIntGraph(BiConsumer<com.mastfrog.abstractions.list.IndexedResolvable<? extends T>,IntGraph> consumer)
consumer - A consumer that takes the list of items and the
graph.ObjectGraph<T> omitting(Set<T> items)
items - The items to omitint size()
Copyright © 2010–2020 Mastfrog Technologies. All rights reserved.