Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text.RegularExpressions;
  5.  
  6. namespace GraphCsh
  7. {
  8. internal class Graph
  9. {
  10. public static Graph Generate(string filename)
  11. {
  12. Graph gr = new Graph();
  13. StreamReader file = new StreamReader(filename);
  14. string filestring;
  15. while ((filestring = file.ReadLine()) != null)
  16. {
  17. Regex regex = new Regex(@"[\d|-1]");
  18. }
  19. return gr;
  20. }
  21.  
  22. Stack<Node> _stack = new Stack<Node>();
  23. }
  24.  
  25. internal class Node
  26. {
  27. private static int numOfNodes;
  28.  
  29. public readonly int Num;
  30.  
  31. static Node()
  32. {
  33. numOfNodes = 0;
  34. }
  35.  
  36. public Node()
  37. {
  38. numOfNodes++;
  39. Num = numOfNodes;
  40. }
  41. public NodeColour Colour
  42. {
  43. get
  44. {
  45. return colour;
  46. }
  47. }
  48.  
  49. public void SetBlack()
  50. {
  51. colour = NodeColour.Black;
  52. Console.WriteLine($"Вершина {Num} Окрашена");
  53. }
  54. private NodeColour colour = NodeColour.White;
  55.  
  56. private Node[] _out;
  57.  
  58. public static bool operator true(Node node)
  59. {
  60. return ((int)node.colour)==1;
  61. }
  62.  
  63. public static bool operator false(Node node)
  64. {
  65. return ((int)node.colour)==0;
  66. }
  67.  
  68. internal enum NodeColour : int{White = 1,Black = 0}
  69. }
  70.  
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement