Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
type cycles feature: window shows type cycles as list or graph
- Loading branch information
Showing
49 changed files
with
845 additions
and
739 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Generic; | ||
|
||
namespace andrena.Usus.net.Core.Graphs | ||
{ | ||
public static class GraphExtensions | ||
{ | ||
public static MutableGraph<V> ToGraph<V>(this IDictionary<V, IEnumerable<V>> graphDict) | ||
where V : class | ||
{ | ||
return new MutableGraph<V>(graphDict); | ||
} | ||
|
||
public static IGraph<V> Select<V, R>(this IGraph<R> graph, Func<R, V> vertexSelector) | ||
where V : class | ||
where R : class | ||
{ | ||
return new GraphSurrogate<V, R>(graph, vertexSelector); | ||
} | ||
} | ||
public static class GraphExtensions | ||
{ | ||
public static MutableGraph<V> ToGraph<V>(this IDictionary<V, IEnumerable<V>> graphDict) | ||
where V : class | ||
{ | ||
return new MutableGraph<V>(graphDict); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
using QuickGraph; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using QuickGraph; | ||
|
||
namespace andrena.Usus.net.Core.Graphs | ||
{ | ||
public class MutableGraph<V> : IGraph<V> where V : class | ||
{ | ||
BidirectionalGraph<V, Edge<V>> graph; | ||
const bool PARALLEL_EDGES = false; | ||
|
||
public IEnumerable<V> Vertices { get { return graph.Vertices; } } | ||
public IEnumerable<Tuple<V, V>> Edges { get { return graph.Edges.Select(e => Tuple.Create(e.Source, e.Target)); } } | ||
|
||
public MutableGraph(IDictionary<V, IEnumerable<V>> graphDict) | ||
{ | ||
graph = graphDict.Keys.ToBidirectionalGraph(v => graphDict[v].Select(e => new Edge<V>(v, e)), PARALLEL_EDGES); | ||
} | ||
|
||
internal MutableGraph(BidirectionalGraph<V, Edge<V>> graph) | ||
{ | ||
this.graph = graph; | ||
} | ||
|
||
public void Reduce(V vertex, IEnumerable<V> vertices) | ||
{ | ||
graph.MergeVertices(vertex, vertices); | ||
} | ||
|
||
public MutableGraph<V> Reach(V start) | ||
{ | ||
var reachGraph = start.ToNewGraph(PARALLEL_EDGES); | ||
graph.Dfs(start, e => reachGraph.AddVerticesAndEdge(e)); | ||
return new MutableGraph<V>(reachGraph); | ||
} | ||
public MutableGraph<R> Cast<R>(Func<V, R> selector, Func<R, bool> condition) where R : class | ||
{ | ||
return graph.Clone(selector, condition); | ||
} | ||
|
||
public StronglyConntectedComponents<V> Cycles() | ||
{ | ||
return graph.Sccs(); | ||
} | ||
} | ||
public class MutableGraph<V> : IGraph<V> where V : class | ||
{ | ||
BidirectionalGraph<V, Edge<V>> graph; | ||
const bool PARALLEL_EDGES = false; | ||
|
||
public IEnumerable<V> Vertices { get { return graph.Vertices; } } | ||
public IEnumerable<Tuple<V, V>> Edges { get { return graph.Edges.Select(e => Tuple.Create(e.Source, e.Target)); } } | ||
|
||
public MutableGraph(IDictionary<V, IEnumerable<V>> graphDict) | ||
{ | ||
graph = graphDict.Keys.ToBidirectionalGraph(v => graphDict[v].Select(e => new Edge<V>(v, e)), PARALLEL_EDGES); | ||
} | ||
|
||
internal MutableGraph(BidirectionalGraph<V, Edge<V>> graph) | ||
{ | ||
this.graph = graph; | ||
} | ||
|
||
public void Reduce(V vertex, IEnumerable<V> vertices) | ||
{ | ||
graph.MergeVertices(vertex, vertices); | ||
} | ||
|
||
public MutableGraph<V> Reach(V start) | ||
{ | ||
var reachGraph = start.ToNewGraph(PARALLEL_EDGES); | ||
graph.Dfs(start, e => reachGraph.AddVerticesAndEdge(e)); | ||
return new MutableGraph<V>(reachGraph); | ||
} | ||
|
||
public MutableGraph<R> Cast<R>(Func<V, R> selector, Func<R, bool> condition) where R : class | ||
{ | ||
return graph.Clone(selector, condition); | ||
} | ||
|
||
public StronglyConntectedComponents<V> Cycles() | ||
{ | ||
return graph.Sccs(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.