i am using graphSharp lib for my project . in which i need to represent more than 10 elements but it did not view properply . here is the code
private void CreateGraphToVisualizenode()
{
var g = new BidirectionalGraph<object, IEdge<object>>();
List<Class1> obj = new List<Class1>();
for (int i = 0; i < 100; i++)
{
Class1 obj1 = new Class1(i,"n");
obj.Add(obj1);
}
for(int i=1;i<100;i++)
{
Color edgeColor = (i % 2 == 0) ? Colors.Black : Colors.Red;
g.AddVerticesAndEdge(new MyEdge(obj[i - 1], obj[i]){
Id = i.ToString(),
EdgeColor = edgeColor });
}
g.AddVerticesAndEdge(new MyEdge(obj[99], obj[0]));
_graphToVisualize = g;
}
public class MyEdge : TypedEdge<Object>
{
public String Id { get; set; }
public Color EdgeColor { get; set; }
public MyEdge(Object source, Object target) : base(source, target, EdgeTypes.General) { }
}
public class EdgeColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return new SolidColorBrush((Color)value);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
and xaml
<window x:class="GraphSharpTutorial01.Window1" xmlns:x="#unknown">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:graphsharp="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls"
xmlns:zoom="clr-namespace:WPFExtensions.Controls;assembly=WPFExtensions"
Title="Window1"
Height="400"
Width="400"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
x:Name="root">
<grid>
<zoom:zoomcontrol xmlns:zoom="#unknown">
<graphsharp:graphlayout x:name="graphLayout" xmlns:graphsharp="#unknown">
Graph="{Binding ElementName=root,Path=GraphToVisualize}"
LayoutAlgorithmType="FR"
OverlapRemovalAlgorithmType="FSA"
HighlightAlgorithmType="Simple"
/>
</graphsharp:graphlayout></zoom:zoomcontrol>
</grid>
</window>
and the solution isall node meged at single point. plz help.