org.grinvin

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)
Make this embedding a copy of the given view using the peer of the original.
void
copy(EmbeddingView original, GraphView newPeer)
Make this embedding a copy of the given view using the given peer.
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)
Sets the coordinates to the given values.
void
setDimension(int dimension)
Set the dimension of the embedding.

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)
Make this embedding a copy of the given view using the peer of the original.
Specified by:
copy in interface Embedding

copy

public void copy(EmbeddingView original,
                 GraphView newPeer)
Make this embedding a copy of the given view using the given peer. This peer is supposed to be a copy of the peer in the sense of method Graph.copy(GraphView).
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)
Sets the coordinates to the given values.
Specified by:
setCoordinates in interface Embedding
Parameters:
vertex - Vertex (of the peer) whose coordinates should be changed
coordinates - Array of coordinates which must be copied.

setDimension

public void setDimension(int dimension)
Set the dimension of the embedding. If this new dimension is different from the current dimension then coordinates of embedded vertices should be reasigned to conform to this new value.
Specified by:
setDimension in interface Embedding