Satsuma
a delicious .NET graph library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Pages
UndirectedGraph.cs
Go to the documentation of this file.
1 #region License
2 /*This file is part of Satsuma Graph Library
3 Copyright © 2013 Balázs Szalkai
4 
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8 
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17 
18  2. Altered source versions must be plainly marked as such, and must not be
19  misrepresented as being the original software.
20 
21  3. This notice may not be removed or altered from any source
22  distribution.*/
23 #endregion
24 
25 using System;
26 using System.Collections.Generic;
27 using System.Linq;
28 
29 namespace Satsuma
30 {
34  public sealed class UndirectedGraph : IGraph
35  {
36  private IGraph graph;
37 
38  public UndirectedGraph(IGraph graph)
39  {
40  this.graph = graph;
41  }
42 
43  public Node U(Arc arc)
44  {
45  return graph.U(arc);
46  }
47 
48  public Node V(Arc arc)
49  {
50  return graph.V(arc);
51  }
52 
53  public bool IsEdge(Arc arc)
54  {
55  return true;
56  }
57 
58  public IEnumerable<Node> Nodes()
59  {
60  return graph.Nodes();
61  }
62 
63  public IEnumerable<Arc> Arcs(ArcFilter filter = ArcFilter.All)
64  {
65  return graph.Arcs(ArcFilter.All);
66  }
67 
68  public IEnumerable<Arc> Arcs(Node u, ArcFilter filter = ArcFilter.All)
69  {
70  return graph.Arcs(u, ArcFilter.All);
71  }
72 
73  public IEnumerable<Arc> Arcs(Node u, Node v, ArcFilter filter = ArcFilter.All)
74  {
75  return graph.Arcs(u, v, ArcFilter.All);
76  }
77 
78  public int NodeCount()
79  {
80  return graph.NodeCount();
81  }
82 
83  public int ArcCount(ArcFilter filter = ArcFilter.All)
84  {
85  return graph.ArcCount(ArcFilter.All);
86  }
87 
88  public int ArcCount(Node u, ArcFilter filter = ArcFilter.All)
89  {
90  return graph.ArcCount(u, ArcFilter.All);
91  }
92 
93  public int ArcCount(Node u, Node v, ArcFilter filter = ArcFilter.All)
94  {
95  return graph.ArcCount(u, v, ArcFilter.All);
96  }
97 
98  public bool HasNode(Node node)
99  {
100  return graph.HasNode(node);
101  }
102 
103  public bool HasArc(Arc arc)
104  {
105  return graph.HasArc(arc);
106  }
107  }
108 }