/// <inheritdoc /> protected override void Initialize() { base.Initialize(); FoundNegativeCycle = false; // Initialize colors and distances VerticesColors.Clear(); foreach (TVertex vertex in VisitedGraph.Vertices) { VerticesColors[vertex] = GraphColor.White; SetVertexDistance(vertex, double.PositiveInfinity); OnInitializeVertex(vertex); } if (!TryGetRootVertex(out TVertex root)) { // Try to fallback on first vertex, will throw if the graph is empty root = VisitedGraph.Vertices.First(); } else if (!VisitedGraph.ContainsVertex(root)) { throw new VertexNotFoundException("Root vertex is not part of the graph."); } SetVertexDistance(root, 0); }
private void NormalizeColorsList() { Vector3 defaultColor = new Vector3(1.0f, 1.0f, 0.0f); for (int i = VerticesColors.Count; i < LocalVertices.Count; i++) { VerticesColors.Add(defaultColor); } }
protected override bool ImportStandtradShapeData() { LocalVertices.Add(new Vector3(-0.5f, -0.5f, 0.0f)); LocalVertices.Add(new Vector3(0.5f, -0.5f, 0.0f)); LocalVertices.Add(new Vector3(0.0f, 0.5f, 0.0f)); VerticesColors.Add(new Vector3(1.0f, 0.0f, 0.0f)); VerticesColors.Add(new Vector3(0.0f, 1.0f, 0.0f)); VerticesColors.Add(new Vector3(0.0f, 0.0f, 1.0f)); return(base.ImportStandtradShapeData()); }
/// <inheritdoc /> protected override void Initialize() { base.Initialize(); Successors.Clear(); VerticesColors.Clear(); foreach (TVertex vertex in VisitedGraph.Vertices) { VerticesColors.Add(vertex, GraphColor.White); OnInitializeVertex(vertex); } }
/// <inheritdoc /> protected override void Initialize() { base.Initialize(); // Put all vertex to white VerticesColors.Clear(); foreach (TVertex vertex in VisitedGraph.Vertices) { VerticesColors[vertex] = GraphColor.White; OnVertexInitialized(vertex); } }
protected override bool ImportStandtradShapeData() { LocalVertices.Add(new Vector3(0.5f, 0.5f, 0.0f)); // Top Right LocalVertices.Add(new Vector3(0.5f, -0.5f, 0.0f)); // Bottom Right LocalVertices.Add(new Vector3(-0.5f, -0.5f, 0.0f)); // Bottom Left LocalVertices.Add(new Vector3(-0.5f, 0.5f, 0.0f)); // Top Left VerticesColors.Add(new Vector3(1.0f, 0.0f, 0.0f)); VerticesColors.Add(new Vector3(0.0f, 1.0f, 0.0f)); VerticesColors.Add(new Vector3(0.0f, 0.0f, 1.0f)); return(base.ImportStandtradShapeData()); }
/// <inheritdoc /> protected override void Initialize() { base.Initialize(); // Initialize colors and distances double initialDistance = DistanceRelaxer.InitialDistance; foreach (TVertex vertex in VisitedGraph.Vertices) { VerticesColors.Add(vertex, GraphColor.White); Distances.Add(vertex, initialDistance); OnVertexInitialized(vertex); } }
/// <inheritdoc /> protected override void Initialize() { base.Initialize(); // Initialize colors and distances double initialDistance = DistanceRelaxer.InitialDistance; foreach (TVertex vertex in VisitedGraph.Vertices) { VerticesColors.Add(vertex, GraphColor.White); SetVertexDistance(vertex, initialDistance); } _vertexQueue = new FibonacciQueue <TVertex, double>(DistancesIndexGetter()); }
/// <inheritdoc /> protected override void Initialize() { base.Initialize(); VerticesColors.Clear(); _costs = new Dictionary <TVertex, double>(VisitedGraph.VertexCount); // Initialize colors and distances double initialDistance = DistanceRelaxer.InitialDistance; foreach (TVertex vertex in VisitedGraph.Vertices) { VerticesColors.Add(vertex, GraphColor.White); SetVertexDistance(vertex, initialDistance); _costs.Add(vertex, initialDistance); } _vertexQueue = new FibonacciQueue <TVertex, double>(_costs, DistanceRelaxer.Compare); }
/// <inheritdoc /> protected override void Initialize() { base.Initialize(); FoundNegativeCycle = false; // Initialize colors and distances VerticesColors.Clear(); foreach (TVertex vertex in VisitedGraph.Vertices) { VerticesColors[vertex] = GraphColor.White; Distances[vertex] = double.PositiveInfinity; OnInitializeVertex(vertex); } if (!TryGetRootVertex(out TVertex root)) { // Try to fallback on first vertex, will throw if the graph is empty root = VisitedGraph.Vertices.First(); } Distances[root] = 0; }