C# 클래스 Smrf.NodeXL.Layouts.FruchtermanReingoldLayout

Lays out a graph using the Fruchterman-Reingold layout.
For details on the layout algorithm, see http://www.cs.ubc.ca/rr/proceedings/spe91-95/spe/vol21/issue11/spe060tf.pdf.

If the graph has a metadata key of , only the vertices specified in the value's IVertex collection are laid out and all other vertices are completely ignored.

If the graph has a metadata key of , the previous layout is used as a starting point for the new layout. Otherwise, the locations of all unlocked vertices are randomized at the start of the layout process.

If a vertex has a metadata key of with a value of true, it is included in layout calculations but its own location is left unmodified.

If an edge has a metadata key of , the edge weight is used in the layout calculations. Edges with larger edge weights exert stronger attractive forces on their vertices. If an edge weight is zero or less, the algorithm ignores it and uses a value of 1.0 instead.

Here is sample C# code that uses a to synchronously lay out a graph. using System; using System.Drawing; using Smrf.NodeXL.Core; using Smrf.NodeXL.Layouts; namespace PopulateAndLayOutGraph { class Program { static void Main(string[] args) { // Create a graph. The graph has no visual representation; it is // just a data structure. Graph oGraph = new Graph(GraphDirectedness.Directed); IVertexCollection oVertices = oGraph.Vertices; IEdgeCollection oEdges = oGraph.Edges; // Add three vertices. IVertex oVertexA = oVertices.Add(); oVertexA.Name = "Vertex A"; IVertex oVertexB = oVertices.Add(); oVertexB.Name = "Vertex B"; IVertex oVertexC = oVertices.Add(); oVertexC.Name = "Vertex C"; // Connect the vertices with directed edges. IEdge oEdge1 = oEdges.Add(oVertexA, oVertexB, true); IEdge oEdge2 = oEdges.Add(oVertexB, oVertexC, true); IEdge oEdge3 = oEdges.Add(oVertexC, oVertexA, true); // Lay out the graph within a 100x100 rectangle. This sets the // IVertex.Location property of each vertex. ILayout oLayout = new FruchtermanReingoldLayout(); LayoutContext oLayoutContext = new LayoutContext(new Rectangle(0, 0, 100, 100)); oLayout.LayOutGraph(oGraph, oLayoutContext); // List the results. foreach (IVertex oVertex in oVertices) { Console.WriteLine("The location of {0} is {1}.", oVertex.Name, oVertex.Location); } } } }
상속: LayoutBase
파일 보기 프로젝트 열기: 2014-sed-team3/term-project 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
m_fC System.Single
m_iIterations System.Int32

공개 메소드들

메소드 설명
AssertValid ( ) : void
FruchtermanReingoldLayout ( ) : System

Initializes a new instance of the FruchtermanReingoldLayout class.

보호된 메소드들

메소드 설명
CalculateAttractiveForces ( ICollection edgesToLayOut, System.Single k ) : void
CalculateRepulsiveForces ( ICollection verticesToLayOut, System.Single k ) : void
InitializeMetadata ( IGraph oGraph, ICollection oVerticesToLayOut ) : void
LayOutGraphCore ( IGraph graph, ICollection verticesToLayOut, LayoutContext layoutContext, BackgroundWorker backgroundWorker ) : System.Boolean
RemoveMetadata ( IGraph oGraph, ICollection oVerticesToLayOut ) : void
RestoreTag ( IMetadataProvider oVertexOrEdge ) : void
SaveTag ( IMetadataProvider oVertexOrEdge ) : void
SetUnboundedLocations ( ICollection verticesToLayOut, LayoutContext layoutContext, System.Single fTemperature, System.Boolean bAlsoSetVertexLocations ) : void

메소드 상세

AssertValid() 공개 메소드

public AssertValid ( ) : void
리턴 void

CalculateAttractiveForces() 보호된 메소드

protected CalculateAttractiveForces ( ICollection edgesToLayOut, System.Single k ) : void
edgesToLayOut ICollection
k System.Single
리턴 void

CalculateRepulsiveForces() 보호된 메소드

protected CalculateRepulsiveForces ( ICollection verticesToLayOut, System.Single k ) : void
verticesToLayOut ICollection
k System.Single
리턴 void

FruchtermanReingoldLayout() 공개 메소드

Initializes a new instance of the FruchtermanReingoldLayout class.
public FruchtermanReingoldLayout ( ) : System
리턴 System

InitializeMetadata() 보호된 메소드

protected InitializeMetadata ( IGraph oGraph, ICollection oVerticesToLayOut ) : void
oGraph IGraph
oVerticesToLayOut ICollection
리턴 void

LayOutGraphCore() 보호된 메소드

protected LayOutGraphCore ( IGraph graph, ICollection verticesToLayOut, LayoutContext layoutContext, BackgroundWorker backgroundWorker ) : System.Boolean
graph IGraph
verticesToLayOut ICollection
layoutContext LayoutContext
backgroundWorker System.ComponentModel.BackgroundWorker
리턴 System.Boolean

RemoveMetadata() 보호된 메소드

protected RemoveMetadata ( IGraph oGraph, ICollection oVerticesToLayOut ) : void
oGraph IGraph
oVerticesToLayOut ICollection
리턴 void

RestoreTag() 보호된 메소드

protected RestoreTag ( IMetadataProvider oVertexOrEdge ) : void
oVertexOrEdge IMetadataProvider
리턴 void

SaveTag() 보호된 메소드

protected SaveTag ( IMetadataProvider oVertexOrEdge ) : void
oVertexOrEdge IMetadataProvider
리턴 void

SetUnboundedLocations() 보호된 메소드

protected SetUnboundedLocations ( ICollection verticesToLayOut, LayoutContext layoutContext, System.Single fTemperature, System.Boolean bAlsoSetVertexLocations ) : void
verticesToLayOut ICollection
layoutContext LayoutContext
fTemperature System.Single
bAlsoSetVertexLocations System.Boolean
리턴 void

프로퍼티 상세

m_fC 보호되어 있는 프로퍼티

protected Single,System m_fC
리턴 System.Single

m_iIterations 보호되어 있는 프로퍼티

protected Int32,System m_iIterations
리턴 System.Int32