- Timestamp:
- 05/28/14 14:18:24 (11 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs
r10888 r10903 129 129 130 130 // add arcs 131 foreach (var node in GenealogyGraph. Nodes) {131 foreach (var node in GenealogyGraph.Vertices) { 132 132 if (!node.InArcs.Any()) continue; 133 133 var visualNode = GetMappedNode(node); … … 246 246 Chart.UpdateEnabled = false; 247 247 ClearPrimitives(); 248 var arcs = GenealogyGraph. Nodes.SelectMany(n => n.InArcs).ToList();248 var arcs = GenealogyGraph.Vertices.SelectMany(n => n.InArcs).ToList(); 249 249 foreach (var arc in arcs) { arc.Weight = 1.0; } // reset weights 250 250 var rank = GenealogyGraph.Ranks.Keys.Max(); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/DirectedGraph.cs
r10897 r10903 35 35 36 36 [Storable] 37 pr ivate readonly List<IVertex> nodes; // for performance reasons, maybe this should be a linked list (fast remove)38 public IEnumerable<IVertex> Nodes {39 get { return nodes; }37 protected readonly List<IVertex> vertices; // for performance reasons, maybe this should be a linked list (fast remove) 38 public IEnumerable<IVertex> Vertices { 39 get { return vertices; } 40 40 } 41 41 … … 46 46 private readonly Dictionary<object, IVertex> contentMap; 47 47 48 [Storable] 49 protected readonly List<IArc> arcs; 50 public IEnumerable<IArc> Arcs { 51 get { return arcs; } 52 } 53 48 54 [StorableConstructor] 49 55 protected DirectedGraph(bool serializing) … … 51 57 } 52 58 59 [StorableHook(HookType.AfterDeserialization)] 60 private void AfterDeserialization() { 61 foreach (var arc in arcs) { 62 arc.Source.AddForwardArc(arc); 63 arc.Target.AddReverseArc(arc); 64 } 65 66 foreach (var vertex in vertices) { 67 vertex.PreContentChanged += Vertex_PreContentChanged; 68 vertex.PostContentChanged += Vertex_PostContentChanged; 69 } 70 } 71 53 72 public DirectedGraph() { 54 nodes = new List<IVertex>(); 73 vertices = new List<IVertex>(); 74 arcs = new List<IArc>(); 55 75 contentMap = new Dictionary<object, IVertex>(); 56 76 idMap = new Dictionary<string, IVertex>(); … … 59 79 protected DirectedGraph(DirectedGraph original, Cloner cloner) 60 80 : base(original, cloner) { 61 nodes = new List<IVertex>(original.Nodes); 81 vertices = new List<IVertex>(original.vertices); 82 arcs = new List<IArc>(original.arcs); 62 83 contentMap = new Dictionary<object, IVertex>(original.contentMap); 63 84 idMap = new Dictionary<string, IVertex>(original.idMap); … … 69 90 70 91 public bool Contains(IVertex t) { 71 return nodes.Contains(t);92 return vertices.Contains(t); 72 93 } 73 94 … … 89 110 90 111 public virtual bool Any(Func<IVertex, bool> predicate) { 91 return nodes.Any(predicate);112 return vertices.Any(predicate); 92 113 } 93 114 94 115 public virtual bool IsEmpty { 95 get { return ! nodes.Any(); }116 get { return !vertices.Any(); } 96 117 } 97 118 98 119 public virtual void Clear() { 99 nodes.Clear();120 vertices.Clear(); 100 121 contentMap.Clear(); 101 122 idMap.Clear(); … … 110 131 } 111 132 idMap.Add(vertex.Id, vertex); 112 nodes.Add(vertex);133 vertices.Add(vertex); 113 134 114 135 vertex.PreContentChanged += Vertex_PreContentChanged; … … 119 140 contentMap.Remove(vertex.Content); 120 141 idMap.Remove(vertex.Id); 121 nodes.Remove(vertex);142 vertices.Remove(vertex); 122 143 144 // remove connections to/from the removed vertex 145 foreach (var arc in vertex.InArcs) { 146 arc.Source.OutArcs = arc.Source.OutArcs.Where(x => x.Target != vertex); 147 } 148 foreach (var arc in vertex.OutArcs) { 149 arc.Target.InArcs = arc.Target.InArcs.Where(x => x.Source != vertex); 150 } 151 // de-register event handlers 123 152 vertex.PreContentChanged -= Vertex_PreContentChanged; 124 153 vertex.PostContentChanged -= Vertex_PostContentChanged; … … 129 158 source.AddForwardArc(arc); 130 159 target.AddReverseArc(arc); 160 arcs.Add(arc); 131 161 return arc; 132 162 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Interfaces/IDirectedGraph.cs
r10897 r10903 32 32 IArc AddArc(IVertex source, IVertex target); 33 33 void RemoveVertex(IVertex vertex); 34 IEnumerable<IVertex> Nodes { get; }34 IEnumerable<IVertex> Vertices { get; } 35 35 bool Contains(object content); 36 36 IVertex GetVertex(string id); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/DirectedGraph/Vertex.cs
r10897 r10903 70 70 } 71 71 72 [Storable]73 72 private List<IArc> inArcs; 74 73 public IEnumerable<IArc> InArcs { … … 77 76 } 78 77 79 [Storable]80 78 private List<IArc> outArcs; 81 79 public IEnumerable<IArc> OutArcs { … … 111 109 112 110 [StorableHook(HookType.AfterDeserialization)] 113 pr otectedvoid AfterDeserialization() {111 private void AfterDeserialization() { 114 112 if (Id == null) { 115 113 id = Guid.NewGuid().ToString(); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraph.cs
r10897 r10903 37 37 set { ranks = value; } 38 38 } 39 public new IEnumerable<IGenealogyGraphNode> Nodes {40 get { return from n in base. Nodes select (IGenealogyGraphNode)n; }39 public new IEnumerable<IGenealogyGraphNode> Vertices { 40 get { return from n in base.Vertices select (IGenealogyGraphNode)n; } 41 41 } 42 42 … … 58 58 source.AddForwardArc(arc); 59 59 target.AddReverseArc(arc); 60 arcs.Add(arc); 60 61 return arc; 61 62 } … … 97 98 set { ranks = value; } 98 99 } 99 public new IEnumerable<IGenealogyGraphNode<T>> Nodes {100 get { return from n in base. Nodes select (IGenealogyGraphNode<T>)n; }100 public new IEnumerable<IGenealogyGraphNode<T>> Vertices { 101 get { return from n in base.Vertices select (IGenealogyGraphNode<T>)n; } 101 102 } 102 103 // contructors … … 132 133 source.AddForwardArc(arc); 133 134 target.AddReverseArc(arc); 135 arcs.Add(arc); 134 136 return arc; 135 137 } 136 IEnumerable<IGenealogyGraphNode> IGenealogyGraph. Nodes {137 get { return Nodes; }138 IEnumerable<IGenealogyGraphNode> IGenealogyGraph.Vertices { 139 get { return Vertices; } 138 140 } 139 141 public event EventHandler GraphUpdated; -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/GenealogyGraphArc.cs
r10888 r10903 31 31 protected GenealogyGraphArc(bool deserializing) : base(deserializing) { } 32 32 protected GenealogyGraphArc(GenealogyGraphArc original, Cloner cloner) 33 : base(original, cloner) { 34 this.Target = original.Target; 35 this.Source = original.Source; 36 this.Label = original.Label; 37 this.Weight = original.Weight; 38 this.Data = original.Data; 39 } 33 : base(original, cloner) { } 40 34 41 35 protected GenealogyGraphArc() { } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking/3.4/GenealogyGraph/Interfaces/IGenealogyGraph.cs
r10888 r10903 26 26 public interface IGenealogyGraph : IDirectedGraph { 27 27 Dictionary<double, List<IGenealogyGraphNode>> Ranks { get; } 28 new IEnumerable<IGenealogyGraphNode> Nodes { get; }28 new IEnumerable<IGenealogyGraphNode> Vertices { get; } 29 29 } 30 30 31 31 public interface IGenealogyGraph<T> : IGenealogyGraph where T : class, IItem { 32 new IEnumerable<IGenealogyGraphNode<T>> Nodes { get; }32 new IEnumerable<IGenealogyGraphNode<T>> Vertices { get; } 33 33 } 34 34 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymboldDataAnalysisGenealogyView.cs
r10897 r10903 106 106 // perform matching like it was done before 107 107 // currently there is no possibility to specify the subtree matching criteria 108 var trees = Content. Nodes.Select(x => x.Content);108 var trees = Content.Vertices.Select(x => x.Content); 109 109 var matchingTrees = trees.Where(x => x.Root.ContainsSubtree(subtree, comparer)); 110 110
Note: See TracChangeset
for help on using the changeset viewer.