Package prefuse.data

Examples of prefuse.data.Table$ColumnEntry


    ComparisonResult result2 = comparer.compare(directedGraph1,
        directedGraph2, true);   
    System.out.println("Empty directed graph test ... " + result2);
   
    //test3
    Table nodeTable1 = new Table();
    nodeTable1.addRows(10);
   
    Table nodeTable2 = new Table();
    nodeTable2.addRows(10);
   
    Graph noEdgeGraph1 = new Graph(nodeTable1, idsPreserved);
    Graph noEdgeGraph2 = new Graph(nodeTable2, idsPreserved);
   
    ComparisonResult result3 = comparer.compare(noEdgeGraph1,
        noEdgeGraph2, false);
    System.out.println("No edge graph test ... " + result3);
   
    //test4 (should fail)
    Table nodeTable3 = new Table();
    nodeTable3.addRows(11);
   
    Graph noEdgeGraph3 = new Graph(nodeTable3, idsPreserved);
   
    ComparisonResult result4 = comparer.compare(noEdgeGraph1,
        noEdgeGraph3, false);
View Full Code Here


   
    /*
     * TODO: (might want to shortcut all of this by counting from 0 to
     * numberOfNodes)
     */
    Table nodeTable = g.getNodeTable();
    for (IntIterator ii = nodeTable.rows(); ii.hasNext();) {
      int nodeID = ii.nextInt();
      Node node = g.getNode(nodeID);
     
      int numEdges = g.getInDegree(node) + g.getOutDegree(node);
     
View Full Code Here

    return nodeFrequencyPairs;
  }

 
  private boolean haveSameNodeAttributes(Graph g1, Graph g2) {
    Table t1 = getStrippedNodeTable(g1);
    Table t2 = getStrippedNodeTable(g2);
    boolean result = areEqualWhenSorted(t1, t2);
    return result;
  }
View Full Code Here

   * for source and target IDs, or the order the edgesappear in the edge
   * tables.
   */
  private boolean haveSameEdgeAttributes(Graph g1, Graph g2) {
    //remove the IDs
    Table t1 = getStrippedEdgeTable(g1.getEdgeTable());
    Table t2 = getStrippedEdgeTable(g2.getEdgeTable());
       
    boolean result = areEqualWhenSorted(t1, t2);
    return result;
  }
View Full Code Here

   *
   * @param t the original table
   * @return a stripped copy of the original table
   */
  private Table getStrippedEdgeTable(Table t) {
    Table tCopy = TableUtil.copyTable(t);
    tCopy.removeColumn(Graph.DEFAULT_SOURCE_KEY);
    tCopy.removeColumn(Graph.DEFAULT_TARGET_KEY);
    return tCopy;
  }
View Full Code Here

    tCopy.removeColumn(Graph.DEFAULT_TARGET_KEY);
    return tCopy;
  }
 
  private Table getStrippedNodeTable(Graph g) {
    Table tCopy = TableUtil.copyTable(g.getNodeTable());
    String nodeKeyField = g.getNodeKeyField();
    if (nodeKeyField != null) {
      tCopy.removeColumn(nodeKeyField);
    }
    return tCopy;
 
View Full Code Here

    //==== Add the new nodes to the graph
    public static void addNodes(Graph newGraph, Visualization v)
    {
      
        //=== Get the backing tables from the new graph
        Table newNodes = (Table)newGraph.getNodes();       
        Table newEdges = (Table)newGraph.getEdges();
        
        //==== add each node from the new graph into the current graph
        for (int i=0; i<newNodes.getRowCount(); i++)
        {
           //=== Add the node to the graph
           currentGraph.getNodes().addTuple(newNodes.getTuple(i));
           //=== Add the node's tuple to the search group, and add it to the search index
           VisualItem newVisualNode = v.getVisualItem(treeNodes, currentGraph.getNodeFromKey(newNodes.getTuple(i).getInt("DEFAULT_NODE_KEY")));
           search.index(newVisualNode, "hoverLabel");
        }
       
        //=== add each edge from the new graph into the current graph
        for (int j=0; j<newEdges.getRowCount(); j++)
        {           
           currentGraph.getEdges().addTuple(newEdges.getTuple(j));
        }
       
        v.run("filter");
        v.run("visibility");
        v.run("repaint");
View Full Code Here

//#################################################################################################
      //==== Generate XML manually using a Graph as the base
    public String writeManualXML(Graph g)
    {
        //==== Get the tables and schemas from the graph
        Table nodes = g.getNodeTable();
        Table edges = g.getEdgeTable();
        Schema nodeSchema = nodes.getSchema();
        Schema edgeSchema = edges.getSchema();
       
        //==== Generate the XML header, and data schema for visualization
        String header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                        "<!--  A paper and all its citations and references  -->\n" +
                        "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\">\n" +
                        "<graph edgedefault=\"directed\">\n\n";
       
        //======================================
        //==== Generate the Nodes table XML
        //======================================
        String nodesTableXML = "<!-- nodes -->\n";
       
        //==== Go through the nodes table, writing a line of XML for each row
        for (int j=0; j<nodes.getRowCount(); j++)
        {
            String row = "";
            for (int k=0; k<nodeSchema.getColumnCount(); k++)
            {
                //=== first column is the node key, start a new node element
                if(k==0)
                 {
                    row = "<node id=\"" + nodes.get(j,k) + "\">\n";
                 }
                //=== the remaining columns are nested data for the node
                else
                 {
                   row = row + "   <data key=\"" + nodeSchema.getColumnName(k) + "\">" + nodes.get(j,k) + "</data>\n";
                 }
            } //  end for, loop through columns
                           
            //=== close off the node, and add it to the nodeTableXML
            row = row + "</node>\n";
            nodesTableXML = nodesTableXML + row;
           
        //end for, loop through rows

        //======================================
        //==== Generate the Edges table XML
        //======================================       
        String edgesTableXML = "<!-- edges -->\n";
       
        //==== Go through the edges table, writing a line of XML for each row
        //====    We know that the edge table has only two columns, source and target
        for (int j=0; j<edges.getRowCount(); j++)
        {
            String row = "<edge source=\"" + edges.get(j,0) + "\" " +
                "target=\"" + edges.get(j, 1) + "\"></edge>\n";
            edgesTableXML = edgesTableXML + row;
        //end for, loop through rows       
       
       
        //==== Generate XML footer
View Full Code Here

    public Table generateNodesTable()
    {
        //==== Get the number of papers
        int nodeCount = Array.getLength(paperList);
        //==== Instantiate the node table schema
        Table node_table = this.nodeSchema.instantiate();
        //==== Add each paper to a row in the node table
        for (int i=0; i<nodeCount; i++)
        {           
            //=== Set all the rows of the table with the paper's information
            node_table.addRow();
            node_table.setInt(i, "DEFAULT_NODE_KEY", i);
            node_table.setString(i, "bibcode", paperList[i].getBibcode());
            node_table.setString(i, "title", paperList[i].getTitle());
            node_table.setString(i, "authorList", paperList[i].getAuthorList());
            node_table.setString(i, "date", paperList[i].getDate());
            node_table.setString(i, "journal", paperList[i].getJournal());
            node_table.setString(i, "citCount", paperList[i].getCitCount());
            node_table.setString(i, "abstractURL", paperList[i].getAbstractURL());
            node_table.setString(i, "refType", paperList[i].getRefType());
            node_table.setString(i, "nodeLabel", paperList[i].getNodeLabel());
            node_table.setString(i, "hoverLabel", paperList[i].getHoverLabel());
            node_table.setString(i, "visible", "true");
            node_table.setString(i, "comment", "");
            node_table.setString(i, "commentStatus", "f");
            node_table.setDouble(i, "xCoordinate", 0);
            node_table.setDouble(i, "yCoordinate", 0);
           
            //=== Since this is a first search, the first paper will always be a focus node
            if(i==0)
            {
                focus_indices.addElement(i);
                node_table.setString(i, "refHidden", "false");
                node_table.setString(i, "citHidden", "false");
                node_table.setString(i, "refExpanded", "true");
                node_table.setString(i, "citExpanded", "true");
            }
           
        }
       
        return node_table;
View Full Code Here

    public Table generateEdgesTable()
    {
        int focus_count = focus_indices.size();
        int rowCount = 0;

        Table edge_table = this.edgeSchema.instantiate();
       
        for (int i=0; i<focus_count; i++)
        {
            int focus_index = (Integer) focus_indices.elementAt(i);
                      
            String[] ref_links = paperList[focus_index].getPaperLinks("REFERENCES");
            String[] cit_links = paperList[focus_index].getPaperLinks("CITATIONS");
           
            int num_ref_links = Array.getLength(ref_links);
            int num_cit_links = Array.getLength(cit_links);
  
            //==== Loop though all the papers, checking to find the reference and citation nodes
            for (int y=0; y<Array.getLength(paperList); y++)
            {
                //==== Loop through all the reference links, find their DEFAULT_NODE_KEY, add a row for the edge
                for (int z=0; z<num_ref_links; z++)
                {
                  if (paperList[y].getBibcode().equals(ref_links[z]))
                  {
                    edge_table.addRow();
                    edge_table.setInt(rowCount, "source", focus_index);
                    edge_table.setInt(rowCount, "target", y);
                    //edge_table.setString(rowCount, "edgeType", "ref");
                    rowCount++;
                  }
                }
               
                //==== Loop through all the citation links, find their DEFAULT_NODE_KEY, add a row for the edge
                for (int x=0; x<num_cit_links; x++)
                {
                  if (paperList[y].getBibcode().equals(cit_links[x]))
                  {
                    edge_table.addRow();
                    edge_table.setInt(rowCount, "source", y);
                    edge_table.setInt(rowCount, "target", focus_index);
                    //edge_table.setString(rowCount, "edgeType", "cit");
                    rowCount++;
                  }
                }
            }  //end for loop, loop through all papers
View Full Code Here

TOP

Related Classes of prefuse.data.Table$ColumnEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.