How to show graph with particular node collapsed

    protected void GenerateTree()
    {
        n = new TreeAppNode();
        n.Editable = false;
        n.Selectable = true;
        goView1.ObjectSingleClicked += new GoObjectEventHandler(this.goView1_ObjectSingleClicked);

        n.LabelSpot = GoObject.Middle;
        n.Text = "";
        n.Shape = new GoRoundedRectangle();
        tr = new GoXmlBindingTransformer("node", n);
        tr.TreeStructured = true;
        tr.TreeLinkPrototype = new GoLink();
        tr.TreeLinksToChildren = true;

        tr.AddBinding("label", "Text");
        doc = goView1.Document;

        rdr = new GoXmlReader();
        rdr.AddTransformer(tr);
        rdr.RootObject = goView1.Document;
        using (StreamReader file = new StreamReader(fileToLoad))
        {
            rdr.Consume(file);
        }
        layout = new GoLayoutTree();
        layout.Document = doc;
        goView1.Dock = DockStyle.Fill;
        // other customizations are described in the GoLayout User Guide
        layout.PerformLayout();
    }

The code above draws my graph from an xml file i have. Every node is expandable/contractble. How can you specify on loading the graph that a certain node be collapsed.?

Also, i have a massive subgraph in one of my nodes. It takes up a lot of space. If i minimise it, space in the graph is freed, but the graph doesnt resize to consume the space? Is this possible

thanks

i would like to add that i have managed to start the programme with the required node collpased by doing this;

        foreach (GoObject o in d)
        {
            if (o is TreeAppNode)
            {
                TreeAppNode n = (TreeAppNode)o;
                if (n.Text.Equals("some text")) 
                {
                    n.Collapse();
                }
            }
        }

however, there is still masses of white space. How can you get the graph to redraw to remove this space until the node is expanded?

thanks

GoDiagram doesn’t do anything to the “other” nodes when you expand/collapse a node. But you could do your GoLayoutTree PerformLayout after every expand/collapse.

[QUOTE=Jake]GoDiagram doesn’t do anything to the “other” nodes when you expand/collapse a node. But you could do your GoLayoutTree PerformLayout after every expand/collapse. [/quote]even then, the node space does not dissapear as the graph knows how big the collapsed node needs to be when it is expanded.

Look at the DataSetDemo sample and do what it does where it prunes the invisible nodes out of the LayoutNetwork.