org.grinvin.graphs

Class DefaultEmbedding

Implemented Interfaces:
Embedding, EmbeddingView
Known Direct Subclasses:
DefaultEmbeddingModel

public class DefaultEmbedding
extends java.lang.Object
implements Embedding

Default implementation of Embedding. Stores coordinates in a hash table.

Field Summary

protected int
dimension
Dimension of this embedding.

Constructor Summary

DefaultEmbedding(EmbeddingView original)
Create a copy of a given embedding which shares the same peer.
DefaultEmbedding(GraphView peer, int dimension)
Create an embedding of the given dimension for the given peer graph.

Method Summary

void
copy(EmbeddingView original)
void
copy(EmbeddingView original, GraphView newPeer)
double[]
getCoordinates(Vertex v)
Return the coordinates of the given vertex.
int
getDimension()
Returns the dimension of the Euclidian space into which this graph is embedded.
GraphView
getPeer()
Returns the peer graph for this embedding.
void
setCoordinates(Vertex vertex, double[] coordinates)
void
setDimension(int dimension)

Field Details

dimension

protected int dimension
Dimension of this embedding.

Constructor Details

DefaultEmbedding

public DefaultEmbedding(EmbeddingView original)
Create a copy of a given embedding which shares the same peer.

DefaultEmbedding

public DefaultEmbedding(GraphView peer,
                        int dimension)
Create an embedding of the given dimension for the given peer graph.

Method Details

copy

public void copy(EmbeddingView original)
Specified by:
copy in interface Embedding

copy

public void copy(EmbeddingView original,
                 GraphView newPeer)
Specified by:
copy in interface Embedding

getCoordinates

public double[] getCoordinates(Vertex v)
Return the coordinates of the given vertex.
Specified by:
getCoordinates in interface EmbeddingView

getDimension

public int getDimension()
Returns the dimension of the Euclidian space into which this graph is embedded.
Specified by:
getDimension in interface EmbeddingView

getPeer

public GraphView getPeer()
Returns the peer graph for this embedding.
Specified by:
getPeer in interface EmbeddingView

setCoordinates

public void setCoordinates(Vertex vertex,
                           double[] coordinates)
Specified by:
setCoordinates in interface Embedding

setDimension

public void setDimension(int dimension)
Specified by:
setDimension in interface Embedding