Click here to Skip to main content
15,889,877 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
C#
private void CreateGraphToVisualizenode()
{
    var g = new BidirectionalGraph<object, IEdge<object>>();
    List<Class1> obj = new List<Class1>();
    //add the vertices to the graph
    for (int i = 0; i < 100; i++)
    {
        Class1 obj1 = new Class1(i,"n");
        obj.Add(obj1);

    }
    //add some edges to the graph

    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
XML
<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.
Posted
Updated 31-Oct-15 22:24pm
v5
Comments
Andy Lanng 28-Oct-15 13:28pm    
Your xml got a bit garbled. I have coded it from what remained but there may be mistakes. Take another look to make sure that it still represents the original xml. If not then use the "Improve Question" button above this comment to update it.
Member 12094885 29-Oct-15 15:12pm    
if you can help now
BillWoodruff 28-Oct-15 13:48pm    
You might ask a question here:

https://graphsharp.codeplex.com/discussions
Member 12094885 29-Oct-15 15:13pm    
ok thanks
phil.o 28-Oct-15 13:56pm    
You may have to define 'did not view properly' to get a meaningful answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900