AddGraphAttribute() public method

public AddGraphAttribute ( String sourceId, ulong timeId, String attribute, Object value ) : void
sourceId String
timeId ulong
attribute String
value Object
return void
Exemplo n.º 1
0
        private static void Example()
        {
            const string sourceId = "C++_netstream_test";
            ulong        timeId   = 0L;
            var          stream   = new NetStreamSender("default", "localhost", 2001);
            const string style    = "node {" +
                                    " shape: rounded-box;" +
                                    " fill-color: grey;" +
                                    " fill-mode: dyn-plain;" +
                                    " size-mode: fit;" +
                                    "}" +
                                    "node.active {" +
                                    " fill-color: green;" +
                                    " size:20px;" +
                                    "}" +
                                    "edge {" +
                                    " shape: cubic-curve;" +
                                    " size: 1px;" +
                                    " arrow-shape: arrow;" +
                                    "}" +
                                    "edge.active {" +
                                    " fill-color: green;" +
                                    " size: 5px;" +
                                    "}";

            stream.AddGraphAttribute(sourceId, timeId++, "stylesheet", style);
            stream.AddGraphAttribute(sourceId, timeId++, "ui.antialias", true);
            stream.AddGraphAttribute(sourceId, timeId++, "ui.quality", true);
            stream.AddGraphAttribute(sourceId, timeId++, "layout.stabilization-limit", 0);
            for (int i = 0; i < 500; i++)
            {
                var n1 = i.ToString();
                AddNodeWithLabel(stream, sourceId, ref timeId, n1);
                if (i > 0)
                {
                    var n2 = (i - 1).ToString();
                    var n3 = (i / 2).ToString();
                    var e1 = n1 + "-" + n2;
                    var e2 = n1 + "-" + n3;

                    AddEdgeWithLabel(stream, sourceId, ref timeId, e1, n1, n2);

                    if (!e1.Equals(e2))
                    {
                        AddEdgeWithLabel(stream, sourceId, ref timeId, e2, n1, n3);
                    }
                }
                //Thread.Sleep(100);
            }
            stream.Close();
        }
Exemplo n.º 2
0
        private static void EventsTest()
        {
            const string sourceId = "C++_netstream_test";
            ulong        timeId   = 0L;
            var          stream   = new NetStreamSender("localhost", 2001);

            stream.AddNode(sourceId, timeId++, "node0");
            stream.AddEdge(sourceId, timeId++, "edge", "node0", "node1", true);
            stream.AddNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute", 0);
            stream.ChangeNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute", 0, 1);
            stream.RemoveNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute");
            stream.AddEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute", 0);
            stream.ChangeEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute", 0, 1);
            stream.RemoveEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute");
            stream.AddGraphAttribute(sourceId, timeId++, "graphAttribute", 0);
            stream.ChangeGraphAttribute(sourceId, timeId++, "graphAttribute", 0, 1);
            stream.RemoveGraphAttribute(sourceId, timeId++, "graphAttribute");
            stream.StepBegins(sourceId, timeId++, 1.1);
            stream.RemoveEdge(sourceId, timeId++, "edge");
            stream.RemoveNode(sourceId, timeId++, "node0");
            stream.GraphClear(sourceId, timeId++);
            stream.Close();
        }
Exemplo n.º 3
0
 private static void EventsTest()
 {
     const string sourceId = "C++_netstream_test";
     ulong timeId = 0L;
     var stream = new NetStreamSender("localhost", 2001);
     stream.AddNode(sourceId, timeId++, "node0");
     stream.AddEdge(sourceId, timeId++, "edge", "node0", "node1", true);
     stream.AddNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute", 0);
     stream.ChangeNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute", 0, 1);
     stream.RemoveNodeAttribute(sourceId, timeId++, "node0", "nodeAttribute");
     stream.AddEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute", 0);
     stream.ChangeEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute", 0, 1);
     stream.RemoveEdgeAttribute(sourceId, timeId++, "edge", "edgeAttribute");
     stream.AddGraphAttribute(sourceId, timeId++, "graphAttribute", 0);
     stream.ChangeGraphAttribute(sourceId, timeId++, "graphAttribute", 0, 1);
     stream.RemoveGraphAttribute(sourceId, timeId++, "graphAttribute");
     stream.StepBegins(sourceId, timeId++, 1.1);
     stream.RemoveEdge(sourceId, timeId++, "edge");
     stream.RemoveNode(sourceId, timeId++, "node0");
     stream.GraphClear(sourceId, timeId++);
     stream.Close();
 }
Exemplo n.º 4
0
        private static void TypesTest()
        {
            const string sourceId = "C++_netstream_test";
            ulong timeId = 0L;
            var stream = new NetStreamSender("default", "localhost", 2001);

            stream.AddGraphAttribute(sourceId, timeId++, "int", 1);
            stream.AddGraphAttribute(sourceId, timeId++, "float", (float) 1);
            stream.AddGraphAttribute(sourceId, timeId++, "double", 1.0);
            stream.AddGraphAttribute(sourceId, timeId++, "long", 1L);
            stream.AddGraphAttribute(sourceId, timeId++, "byte", (char) 0);
            stream.AddGraphAttribute(sourceId, timeId++, "boolean", true);

            int[] v = {1776, 7, 4};
            stream.AddGraphAttribute(sourceId, timeId++, "intArray", v);

            float[] v2 = {1776.3f, 7.3f};
            stream.AddGraphAttribute(sourceId, timeId++, "floatArray", v2);

            double[] v3 = {776.3, .3};
            stream.AddGraphAttribute(sourceId, timeId++, "doubleArray", v3);

            long[] v4 = {1776, 7, 4};
            stream.AddGraphAttribute(sourceId, timeId++, "longArray", v4);

            char[] v5 = {'0', (char) 0, 'z'};
            stream.AddGraphAttribute(sourceId, timeId++, "byteArray", v5);

            bool[] v6 = {true, false};
            stream.AddGraphAttribute(sourceId, timeId++, "booleanArray", v6);

            stream.AddGraphAttribute(sourceId, timeId++, "string", "true");
            stream.Close();
        }
Exemplo n.º 5
0
        private static void Example()
        {
            const string sourceId = "C++_netstream_test";
            ulong timeId = 0L;
            var stream = new NetStreamSender("default", "localhost", 2001);
            const string style = "node {" +
                " shape: rounded-box;" +
                " fill-color: grey;" +
                " fill-mode: dyn-plain;" +
                " size-mode: fit;" +
                "}" +
                "node.active {" +
                " fill-color: green;" +
                " size:20px;" +
                "}" +
                "edge {" +
                " shape: cubic-curve;" +
                " size: 1px;" +
                " arrow-shape: arrow;" +
                "}" +
                "edge.active {" +
                " fill-color: green;" +
                " size: 5px;" +
                "}";
            stream.AddGraphAttribute(sourceId, timeId++, "stylesheet", style);
            stream.AddGraphAttribute(sourceId, timeId++, "ui.antialias", true);
            stream.AddGraphAttribute(sourceId, timeId++, "ui.quality", true);
            stream.AddGraphAttribute(sourceId, timeId++, "layout.stabilization-limit", 0);
            for (int i = 0; i < 500; i++)
            {
                var n1 = i.ToString();
                AddNodeWithLabel(stream, sourceId, ref timeId, n1);
                if (i > 0)
                {
                    var n2 = (i - 1).ToString();
                    var n3 = (i/2).ToString();
                    var e1 = n1 + "-" + n2;
                    var e2 = n1 + "-" + n3;

                    AddEdgeWithLabel(stream, sourceId, ref timeId, e1, n1, n2);

                    if (!e1.Equals(e2))
                        AddEdgeWithLabel(stream, sourceId, ref timeId, e2, n1, n3);
                }
                //Thread.Sleep(100);
            }
            stream.Close();
        }
Exemplo n.º 6
0
        private static void TypesTest()
        {
            const string sourceId = "C++_netstream_test";
            ulong        timeId   = 0L;
            var          stream   = new NetStreamSender("default", "localhost", 2001);

            stream.AddGraphAttribute(sourceId, timeId++, "int", 1);
            stream.AddGraphAttribute(sourceId, timeId++, "float", (float)1);
            stream.AddGraphAttribute(sourceId, timeId++, "double", 1.0);
            stream.AddGraphAttribute(sourceId, timeId++, "long", 1L);
            stream.AddGraphAttribute(sourceId, timeId++, "byte", (char)0);
            stream.AddGraphAttribute(sourceId, timeId++, "boolean", true);

            int[] v = { 1776, 7, 4 };
            stream.AddGraphAttribute(sourceId, timeId++, "intArray", v);

            float[] v2 = { 1776.3f, 7.3f };
            stream.AddGraphAttribute(sourceId, timeId++, "floatArray", v2);

            double[] v3 = { 776.3, .3 };
            stream.AddGraphAttribute(sourceId, timeId++, "doubleArray", v3);

            long[] v4 = { 1776, 7, 4 };
            stream.AddGraphAttribute(sourceId, timeId++, "longArray", v4);

            char[] v5 = { '0', (char)0, 'z' };
            stream.AddGraphAttribute(sourceId, timeId++, "byteArray", v5);

            bool[] v6 = { true, false };
            stream.AddGraphAttribute(sourceId, timeId++, "booleanArray", v6);

            stream.AddGraphAttribute(sourceId, timeId++, "string", "true");
            stream.Close();
        }