Interface CoresAlgo
-
public interface CoresAlgo
Cores computing algorithm.Given a graph \(G=(V,E)\), a subgraph \(H\) induced by a subset of vertices \(W\) is a \(k\)-core or a core of order \(k\) if \(\forall v \in W : deg_H(v) \geq k\) and \(H\) is a maximal subgraph with this property. The core number of vertex is the highest order of a core that contains this vertex. The degree \(deg(v)\) can be: in-degree, out-degree, in-degree + out-degree, determining different types of cores. See
EdgeDirection
for more details.Use
newInstance()
to get a default implementation of this interface. A builder obtained vianewBuilder()
may support different options to obtain different implementations.- Author:
- Barak Ugav
- See Also:
EdgeDirection
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
CoresAlgo.Builder
A builder forCoresAlgo
objects.static interface
CoresAlgo.IResult
The result of the cores computation forIntGraph
.static interface
CoresAlgo.Result<V,E>
The result of the cores computation.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <V,E>
CoresAlgo.Result<V,E>computeCores(Graph<V,E> g)
Compute the cores of the graph with respect to both in and out degree of the vertices.<V,E>
CoresAlgo.Result<V,E>computeCores(Graph<V,E> g, EdgeDirection degreeType)
Compute the cores of the graph with respect the given degree type.static CoresAlgo.Builder
newBuilder()
Create a new builder for core algorithms.static CoresAlgo
newInstance()
Create a new cores algorithm object.
-
-
-
Method Detail
-
computeCores
default <V,E> CoresAlgo.Result<V,E> computeCores(Graph<V,E> g)
Compute the cores of the graph with respect to both in and out degree of the vertices.If
g
isIntGraph
, the returned object isCoresAlgo.IResult
.For a detail description of the cores definition, see the interface documentation
CoresAlgo
.- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- a graph- Returns:
- the cores of the graph
-
computeCores
<V,E> CoresAlgo.Result<V,E> computeCores(Graph<V,E> g, EdgeDirection degreeType)
Compute the cores of the graph with respect the given degree type.Cores are defined with respect to either the out edges, in edges, or both. For undirected graphs the degree type is ignored.
If
g
isIntGraph
, the returned object isCoresAlgo.IResult
.For a detail description of the cores definition, see the interface documentation
CoresAlgo
.- Type Parameters:
V
- the vertices typeE
- the edges type- Parameters:
g
- a graphdegreeType
- the degree type the cores are computed with respect to- Returns:
- the cores of the graph
-
newInstance
static CoresAlgo newInstance()
Create a new cores algorithm object.This is the recommended way to instantiate a new
CoresAlgo
object. TheCoresAlgo.Builder
might support different options to obtain different implementations.- Returns:
- a default implementation of
CoresAlgo
-
newBuilder
static CoresAlgo.Builder newBuilder()
Create a new builder for core algorithms.Use
newInstance()
for a default implementation.- Returns:
- a new builder for core algorithms
-
-