public class IsomorphicGraphCounter<G extends Graph<? extends Edge>> extends Object implements Counter<G>, Serializable
Counter
that counts graphs based on isomorphism, rather
than object equivalence (which may take into account vertex labeling, etc.).
Most commonly, isomorphism is needed when counting the number of motifs in a
graph and their relative occurrences. This class allows the isomorhism test
to be provided by the user, which can enfornce further refinements on
isomorphism (such as vertex and ege types).Constructor and Description |
---|
IsomorphicGraphCounter()
Creates a new
IsomorphicGraphCounter with the default IsomorphismTester that tests for structural equivalence. |
IsomorphicGraphCounter(Collection<? extends G> motifs)
Creates a new
IsomorphicGraphCounter that counts only the specified motifs. |
IsomorphicGraphCounter(IsomorphismTester isoTest)
Creates a new
IsomorphicGraphCounter with the specified isomorphism tester. |
Modifier and Type | Method and Description |
---|---|
void |
add(Counter<? extends G> c)
Counts the number of isomorphic graphs in
c and includes their
sum in this counter. |
void |
addInitial(G g)
Fill in
|
int |
count(G g)
Counts the isomorphic version of this graph, increasing the total by 1
|
int |
count(G g,
int count)
Counts the isomorphic version of this graph, increasing its total count
by the specified positive amount.
|
void |
countAll(Collection<? extends G> c)
Counts all the elements in the collection.
|
int |
getCount(G g)
Returns the count for graphs that are isomorphic to the provided graph.
|
double |
getFrequency(G obj)
Returns the frequency of this object relative to the counts of all other
objects.
|
Set<G> |
items()
Returns a view of the items currently being counted.
|
Iterator<Map.Entry<G,Integer>> |
iterator()
Returns an interator over the elements that have been counted thusfar and
their respective counts.
|
G |
max()
Returns the element that currently has the largest count.
|
G |
min()
Returns the element that currently has the smallest count.
|
void |
reset()
Resets the counts for all objects.
|
int |
size()
Returns the number of unique instances that are currently being counted.
|
int |
sum()
Returns the total number of instances that have been counted.
|
public IsomorphicGraphCounter()
IsomorphicGraphCounter
with the default IsomorphismTester
that tests for structural equivalence.public IsomorphicGraphCounter(IsomorphismTester isoTest)
IsomorphicGraphCounter
with the specified isomorphism tester.
Most users will not need this constructor, which is intended for special
cases where an IsomorphismTester
is tailored to quickly match the
type of motifs being counted.public IsomorphicGraphCounter(Collection<? extends G> motifs)
IsomorphicGraphCounter
that counts only the specified motifs.
All other non-isomorphic graphs will not be counted.public void add(Counter<? extends G> c)
c
and includes their
sum in this counter.public void addInitial(G g)
public int count(G g)
public int count(G g, int count)
public void countAll(Collection<? extends G> c)
public int getCount(G g)
public double getFrequency(G obj)
obj
being seen in the items that have been counted.getFrequency
in interface Counter<G extends Graph<? extends Edge>>
public Set<G> items()
UnsupportedOperationException
.public Iterator<Map.Entry<G,Integer>> iterator()
public G max()
null
is returned. Ties in counts are
arbitrarily broken.public G min()
null
is returned. Ties in counts are
arbitrarily broken.public void reset()
Counter.items()
will be
0 after this call.public int size()
Copyright © 2012. All Rights Reserved.