Examples of CyNode


Examples of org.cytoscape.model.CyNode

        //get selected node
        List<CyNode> nodes = network.getNodeList();
        Set<Long> selectedNodes = new HashSet<Long>();
    for (Iterator iterator = nodes.iterator(); iterator.hasNext();)
    {
      CyNode n = (CyNode)iterator.next();
      if (((Boolean)network.getRow(n).get("selected", java.lang.Boolean.class)).booleanValue())
        selectedNodes.add(n.getSUID());
    }
   
   
//        Set selectedNodes = network.getSelectedNodes();
        Long[] selectedNodesRGI = new Long[selectedNodes.size()];
View Full Code Here

Examples of org.cytoscape.model.CyNode

          boolean layoutNecessary = false;
          CyNetworkView clusterView = cluster.getView();

          for (View nv : newNetworkView.getNodeViews()) {
            CyNode node = (CyNode)nv.getModel();
            View cnv = clusterView != null ? clusterView.getNodeView(node) : null;

            if (cnv != null)
            {
              double x = ((Double)cnv.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION)).doubleValue();
View Full Code Here

Examples of org.cytoscape.model.CyNode

        CyNetwork net = ((Cluster)ResultPanel.this.clusters.get(this.selectedRow)).getNetwork();
        Object value;
        for (Iterator localIterator1 = net.getNodeList().iterator(); localIterator1.hasNext();
          )
        {
          CyNode node = (CyNode)localIterator1.next();

          ArrayList attributeValues = new ArrayList();
          CyRow row = net.getRow(node);
          Class type = row.getTable().getColumn(attributeName).getType();
View Full Code Here

Examples of org.cytoscape.model.CyNode

        // Objects in this array for reuse.
        Integer[] integers = new Integer[nodes.length];

        // Fill the nodes array with the nodes in their proper index locations.
        //int index;
        CyNode from_node;

        for (int i = 0; i < nodes.length; i++) {

            from_node = (CyNode) nodesList.get(i);
            if (from_node == null) {
                continue;
            }
            int index = ((Integer)nodeIndexToMatrixIndexMap.get(from_node.getSUID())).intValue();
            //index = ((Integer) nodeIndexToMatrixIndexMap.get(new Integer(from_node.getRootGraphIndex()))).intValue();

            if ((index < 0) || (index >= nodes.length)) {
                System.err.println("WARNING: GraphNode \"" + from_node +
                        "\" has an index value that is out of range: " +
                        index +
                        ".  Graph indices should be maintained such " +
                        "that no index is unused.");
                return null;
            }
            if (nodes[index] != null) {
                System.err.println("WARNING: GraphNode \"" + from_node +
                        "\" has an index value ( " + index + " ) that is the same as " +
                        "that of another GraphNode ( \"" + nodes[index] +
                        "\" ).  Graph indices should be maintained such " +
                        "that indices are unique.");
                return null;
            }
            nodes[index] = from_node;
            Integer in = new Integer(index);
            integers[index] = in;
        }

        LinkedList queue = new LinkedList();
        boolean[] completed_nodes = new boolean[nodes.length];
        Iterator neighbors;
        CyNode to_node;
        CyNode neighbor;
        int neighbor_index;
        int to_node_distance;
        int neighbor_distance;
        for (int from_node_index = 0;
             from_node_index < nodes.length;
             from_node_index++) {

            if (this.interrupted) {
                // The task was canceled
                this.distances = null;
                return this.distances;
            }

            from_node = nodes[from_node_index];

            if (from_node == null) {
                // Make the distances in this row all Integer.MAX_VALUE.
                if (distances[from_node_index] == null) {
                    distances[from_node_index] = new int[nodes.length];
                }
                Arrays.fill(distances[from_node_index], Integer.MAX_VALUE);
                continue;
            }

            // TODO: REMOVE
            //  System.err.print( "Calculating node distances from graph node " +
            //                  from_node );
            //System.err.flush();

            // Make the distances row and initialize it.
            if (distances[from_node_index] == null) {
                distances[from_node_index] = new int[nodes.length];
            }
            Arrays.fill(distances[from_node_index], Integer.MAX_VALUE);
            distances[from_node_index][from_node_index] = 0;

            // Reset the completed nodes array.
            Arrays.fill(completed_nodes, false);

            // Add the start node to the queue.
            queue.add(integers[from_node_index]);

            while (!(queue.isEmpty())) {

                if (this.interrupted) {
                    // The task was canceled
                    this.distances = null;
                    return this.distances;
                }

                int index = ((Integer) queue.removeFirst()).intValue();
                if (completed_nodes[index]) {
                    continue;
                }
                completed_nodes[index] = true;

                to_node = nodes[index];
                to_node_distance = distances[from_node_index][index];

                if (index < from_node_index) {
                    // Oh boy.  We've already got every distance from/to this node.
                    int distance_through_to_node;
                    for (int i = 0; i < nodes.length; i++) {
                        if (distances[index][i] == Integer.MAX_VALUE) {
                            continue;
                        }
                        distance_through_to_node =
                                to_node_distance + distances[index][i];
                        if (distance_through_to_node <=
                                distances[from_node_index][i]) {
                            // Any immediate neighbor of a node that's already been
                            // calculated for that does not already have a shorter path
                            // calculated from from_node never will, and is thus complete.
                            if (distances[index][i] == 1) {
                                completed_nodes[i] = true;
                            }
                            distances[from_node_index][i] =
                                    distance_through_to_node;
                        }
                    } // End for every node, update the distance using the distance from
                    // to_node.
                    // So now we don't need to put any neighbors on the queue or
                    // anything, since they've already been taken care of by the previous
                    // calculation.
                    continue;
                } // End if to_node has already had all of its distances calculated.

                neighbors = getNeighbors(to_node).iterator();
               
                //neighbors = perspective.neighborsList(to_node).iterator();

                while (neighbors.hasNext()) {

                    if (this.interrupted) {
                        this.distances = null;
                        return this.distances;
                    }

                    neighbor = (CyNode) neighbors.next();

                   
                    neighbor_index = ((Integer)nodeIndexToMatrixIndexMap.get(neighbor.getSUID())).intValue();
                   
                    //neighbor_index = ((Integer) nodeIndexToMatrixIndexMap.get(new Integer(neighbor.getRootGraphIndex()))).intValue();

                    // If this neighbor was not in the incoming List, we cannot include
                    // it in any paths.
View Full Code Here

Examples of org.cytoscape.model.CyNode

        nodeIndexToMatrixIndexMap = new HashMap();
    matrixIndexToNodeIndexMap = new TreeMap();
    Iterator nodes = ((CyNetwork)graphView.getModel()).getNodeList().iterator();
    for (int count = 0; nodes.hasNext(); count++)
    {
      CyNode n = (CyNode)nodes.next();
      nodeIndexToMatrixIndexMap.put(n.getSUID(), Integer.valueOf(count));
      matrixIndexToNodeIndexMap.put(Integer.valueOf(count), n.getSUID());
    }


        // Stop if all nodes are closer together than this euclidean distance.
        // TODO: Why is this an appropriate threshold?
View Full Code Here

Examples of org.cytoscape.model.CyNode

    nodeIndexToMatrixIndexMap = new HashMap();
    matrixIndexToNodeIndexMap = new TreeMap();
    Iterator nodes = ((CyNetwork)graphView.getModel()).getNodeList().iterator();
    for (int count = 0; nodes.hasNext(); count++)
    {
      CyNode n = (CyNode)nodes.next();
      nodeIndexToMatrixIndexMap.put(n.getSUID(), Integer.valueOf(count));
      matrixIndexToNodeIndexMap.put(Integer.valueOf(count), n.getSUID());
    }

    double euclidean_distance_threshold = 0.5D * (double)(nodeCount + edgeCount);
    int num_iterations = (int)(((double)nodeCount * averageIterationsPerNode) / (double)numLayoutPasses);
    List partials_list = createPartialsList();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.