|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.webgraph.ImmutableGraph
it.unimi.dsi.webgraph.ImmutableSequentialGraph
it.unimi.dsi.webgraph.examples.ErdosRenyiGraph
public class ErdosRenyiGraph
An Erdős–Rényi random graph: the number of nodes is fixed, and there is a fixed probability that an arc is put between any two nodes (independently for every pair).
Note that an instance of this class is not random-access: you can, however, make a mutable copy of the returned graph and then take its immutable view.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class it.unimi.dsi.webgraph.ImmutableGraph |
---|
ImmutableGraph.LoadMethod |
Field Summary |
---|
Fields inherited from class it.unimi.dsi.webgraph.ImmutableGraph |
---|
GRAPHCLASS_PROPERTY_KEY, PROPERTIES_EXTENSION |
Constructor Summary | |
---|---|
ErdosRenyiGraph(int n,
double p,
boolean loops)
Creates an Erdős–Rényi graph with given parameters. |
|
ErdosRenyiGraph(int n,
double p,
long seed,
boolean loops)
Creates an Erdős–Rényi graph with given parameters and random seed. |
|
ErdosRenyiGraph(int n,
long m,
boolean loops)
Creates an Erdős–Rényi graph with given parameters and random seed. |
|
ErdosRenyiGraph(int n,
long m,
long seed,
boolean loops)
Creates an Erdős–Rényi graph with given parameters and random seed. |
|
ErdosRenyiGraph(String n,
String p)
Creates an Erdős–Rényi graph with given parameters and no loops. |
|
ErdosRenyiGraph(String n,
String p,
String loops)
Creates an Erdős–Rényi graph with given parameters. |
|
ErdosRenyiGraph(String n,
String p,
String seed,
String loops)
Creates an Erdős–Rényi graph with given parameters and random seed. |
Method Summary | |
---|---|
ErdosRenyiGraph |
copy()
Throws an UnsupportedOperationException . |
ImmutableGraph |
generate()
Deprecated. An instance of this class is already an ImmutableSequentialGraph . |
ImmutableSequentialGraph |
generate(long seed)
Deprecated. An instance of this class is already an ImmutableSequentialGraph . |
static void |
main(String[] arg)
|
NodeIterator |
nodeIterator()
Returns a node iterator for scanning the graph sequentially, starting from the first node. |
int |
numNodes()
Returns the number of nodes of this graph. |
Methods inherited from class it.unimi.dsi.webgraph.ImmutableSequentialGraph |
---|
nodeIterator, outdegree, randomAccess, successorArray |
Methods inherited from class it.unimi.dsi.webgraph.ImmutableGraph |
---|
basename, equals, hashCode, load, load, load, loadMapped, loadMapped, loadOffline, loadOffline, loadOnce, loadSequential, loadSequential, numArcs, outdegrees, store, store, successors, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ErdosRenyiGraph(int n, double p, long seed, boolean loops)
n
- the number of nodes.p
- the probability of generating an arc.seed
- a seed for pseudorandom number generation.loops
- whether loops are allowed or not.public ErdosRenyiGraph(int n, double p, boolean loops)
n
- the number of nodes.p
- the probability of generating an arc.loops
- whether loops are allowed or not.public ErdosRenyiGraph(String n, String p, String seed, String loops)
This constructor can be used with an ObjectParser
.
n
- the number of nodes.p
- the probability of generating an arc.seed
- a seed for pseudorandom number generation.loops
- whether loops are allowed or not.public ErdosRenyiGraph(String n, String p)
This constructor can be used with an ObjectParser
.
n
- the number of nodes.p
- the probability of generating an arc.public ErdosRenyiGraph(String n, String p, String loops)
This constructor can be used with an ObjectParser
.
n
- the number of nodes.p
- the probability of generating an arc.loops
- whether loops are allowed or not.public ErdosRenyiGraph(int n, long m, long seed, boolean loops)
n
- the number of nodes.m
- the expected number of arcs.seed
- a seed for pseudorandom number generation.loops
- whether loops are allowed or not.public ErdosRenyiGraph(int n, long m, boolean loops)
n
- the number of nodes.m
- the expected number of arcs.loops
- whether loops are allowed or not.Method Detail |
---|
public int numNodes()
ImmutableGraph
Albeit this method is not optional, it is allowed that this method throws
an UnsupportedOperationException
if this graph has never been entirely
traversed using a node iterator
. This apparently bizarre
behaviour is necessary to support implementations as ArcListASCIIGraph
, which
do not know the actual number of nodes until a traversal has been completed.
numNodes
in class ImmutableGraph
public ErdosRenyiGraph copy()
ImmutableSequentialGraph
UnsupportedOperationException
.
copy
in interface FlyweightPrototype<ImmutableGraph>
copy
in class ImmutableSequentialGraph
FlyweightPrototype
public NodeIterator nodeIterator()
ImmutableGraph
nodeIterator
in class ImmutableGraph
NodeIterator
for accessing nodes and successors sequentially.@Deprecated public ImmutableSequentialGraph generate(long seed)
ImmutableSequentialGraph
.
This method exists only for backward compatibility.
seed
- the seed for random generation.
@Deprecated public ImmutableGraph generate()
ImmutableSequentialGraph
.
This method exists only for backward compatibility.
public static void main(String[] arg) throws IOException, JSAPException
IOException
JSAPException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |