public LayoutAlgorithm(IVertexAndEdgeListGraph visitedGraph, IVertexPointFDictionary positions) { this.edgeLength = 20f; this.layoutSize = new Size(800, 600); this.positions = new VertexPointFDictionary(); this.computationAbortion = false; this.visitedGraph = visitedGraph; this.positions = positions; }
public void SetPositions(IVertexPointFDictionary positions) { if (positions == null) { throw new ArgumentNullException("positions"); } foreach (DictionaryEntry de in positions) { this.positions[(IVertex)de.Key] = (PointF)de.Value; } }
public override void Compute(IVertexPointFDictionary potentials) { // in-edges int i = 0; foreach (IVertex u in this.Algorithm.VisitedGraph.Vertices) { PointF pu = this.Algorithm.Positions[u]; int j = 0; foreach (IVertex v in this.Algorithm.VisitedGraph.Vertices) { if (j <= i) { ++j; continue; } PointF pv = this.Algorithm.Positions[v]; PointF a = PointMath.Sub(pv, pu); double duv = PointMath.Distance(pu, pv); // added repulsion double fr = this.RepulsionForce(duv); potentials[u] = PointMath.Combili(potentials[u], -checked (fr / duv), a); potentials[v] = PointMath.Combili(potentials[v], checked (fr / duv), a); if (this.Algorithm.VisitedGraph.ContainsEdge(u, v) || this.Algorithm.VisitedGraph.ContainsEdge(v, u)) { double fa = this.AttractionForce(duv); potentials[u] = PointMath.Combili(potentials[u], checked (fa / duv), a); potentials[v] = PointMath.Combili(potentials[v], -checked (fa / duv), a); } ++j; } ++i; } }
public override void Compute(IVertexPointFDictionary potentials) { // in-edges int i=0; foreach(IVertex u in this.Algorithm.VisitedGraph.Vertices) { PointF pu = this.Algorithm.Positions[u]; int j=0; foreach(IVertex v in this.Algorithm.VisitedGraph.Vertices) { if (j<=i) { ++j; continue; } PointF pv = this.Algorithm.Positions[v]; PointF a = PointMath.Sub(pv,pu); double duv = PointMath.Distance(pu,pv); // added repulsion double fr = this.RepulsionForce(duv); potentials[u] = PointMath.Combili(potentials[u],-checked(fr/duv),a); potentials[v] = PointMath.Combili(potentials[v],checked(fr/duv),a); if (this.Algorithm.VisitedGraph.ContainsEdge(u,v) || this.Algorithm.VisitedGraph.ContainsEdge(v,u)) { double fa = this.AttractionForce(duv); potentials[u] = PointMath.Combili(potentials[u],checked(fa/duv),a); potentials[v] = PointMath.Combili(potentials[v],-checked(fa/duv),a); } ++j; } ++i; } }
public override void Compute(IVertexPointFDictionary potentials) { int num = 0; IVertexEnumerator enumerator = base.Algorithm.VisitedGraph.get_Vertices().GetEnumerator(); while (enumerator.MoveNext()) { IVertex vertex = enumerator.get_Current(); PointF tf = base.Algorithm.Positions.get_Item(vertex); int num2 = 0; IVertexEnumerator enumerator2 = base.Algorithm.VisitedGraph.get_Vertices().GetEnumerator(); while (enumerator2.MoveNext()) { IVertex vertex2 = enumerator2.get_Current(); if (num2 <= num) { num2++; } else { PointF tf2 = base.Algorithm.Positions.get_Item(vertex2); PointF p = PointMath.Sub(tf2, tf); double distance = PointMath.Distance(tf, tf2); double num4 = this.RepulsionForce(distance); potentials.set_Item(vertex, PointMath.Combili(potentials.get_Item(vertex), -(num4 / distance), p)); potentials.set_Item(vertex2, PointMath.Combili(potentials.get_Item(vertex2), (double) (num4 / distance), p)); if (base.Algorithm.VisitedGraph.ContainsEdge(vertex, vertex2) || base.Algorithm.VisitedGraph.ContainsEdge(vertex2, vertex)) { double num5 = this.AttractionForce(distance); potentials.set_Item(vertex, PointMath.Combili(potentials.get_Item(vertex), (double) (num5 / distance), p)); potentials.set_Item(vertex2, PointMath.Combili(potentials.get_Item(vertex2), -(num5 / distance), p)); } num2++; } } num++; } }
public void SetPositions(IVertexPointFDictionary positions) { if (positions==null) throw new ArgumentNullException("positions"); foreach(DictionaryEntry de in positions) this.positions[(IVertex)de.Key]=(PointF)de.Value; }
public LayoutAlgorithm(IVertexAndEdgeListGraph visitedGraph,IVertexPointFDictionary positions) { this.visitedGraph=visitedGraph; this.positions = positions; }
public RandomLayoutAlgorithm(IVertexAndEdgeListGraph visitedGraph, IVertexPointFDictionary positions) : base(visitedGraph, positions) { this.rnd = new Random((int) DateTime.Now.Ticks); }
public RandomLayoutAlgorithm( IVertexAndEdgeListGraph visitedGraph, IVertexPointFDictionary positions) : base(visitedGraph, positions) { }
public void SetPositions(IVertexPointFDictionary positions) { if (positions == null) { throw new ArgumentNullException("positions"); } IDictionaryEnumerator enumerator = positions.GetEnumerator(); while (enumerator.MoveNext()) { DictionaryEntry current = (DictionaryEntry) enumerator.Current; this.positions.set_Item((IVertex) current.Key, (PointF) current.Value); } }
public RandomLayoutAlgorithm( IVertexAndEdgeListGraph visitedGraph, IVertexPointFDictionary positions) : base(visitedGraph,positions) { }
public LayoutAlgorithm(IVertexAndEdgeListGraph visitedGraph,IVertexPointFDictionary positions) { this.visitedGraph=visitedGraph; this.positions = positions; }
public abstract void Compute(IVertexPointFDictionary potentials);
public abstract void Compute(IVertexPointFDictionary potentials);