|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.isb.metanodes.data.SimpleMetaNodeAttributesHandler
public class SimpleMetaNodeAttributesHandler
Implementation of MetaNodesAttributesHandler that transfers the union of all attributes on the child nodes to the parent meta-nodes.
This is a specific implementation of MetaNodesAttributesHandler that:
1) Handles canonical and common naming of the new meta_node and its associated meta_edges. 2) Transfers the union of all attributes on the child nodes to the parent meta node. 3) Transfers edge attributes from each child edge to its corresponding meta edge 4) Collapses meta edges with the same name, taking the union of their attributes
Step 4 above is invoked whenever multiple meta_edges connect from the same source or target. For instance, consider the graph: A pd B A pd C If the user collapses B and C into a meta_node, this will create corresponding meta_edges: A (pd) MetaNode1 A (pd) MetaNode1 which will have their attributes transferred and then get themselves collapsed to a single edge. Of course, this was a specific design decision on my part and I could have handled things differently. But in this case where you are collapsing many (N) nodes with the same neighbor, it seems undesirable to end up with N edges connecting this neighbor to the meta_node.
Nested Class Summary | |
---|---|
protected class |
SimpleMetaNodeAttributesHandler.CopyEdgeAttr
Procedure class to copy over edge attributes |
Field Summary | |
---|---|
protected String |
nodeLabelAttribute
The name of the node attribute to which meta-node names should be assigned to |
protected HashSet |
usedEdgeNames
Tracks the edge names that have been examined so far |
Fields inherited from interface org.isb.metanodes.data.MetaNodeAttributesHandler |
---|
DEFAULT_NODE_LABEL_ATTRIBUTE |
Constructor Summary | |
---|---|
SimpleMetaNodeAttributesHandler()
|
Method Summary | |
---|---|
String |
assignName(CyNetwork cy_net,
CyNode node)
Transfers all children names to meta node name |
protected String |
getCanonicalMetaName(CyNode node)
Method to encapsulate the canonical naming of meta nodes and edges |
protected String |
getCommonMetaName(CyNode node,
CyNetwork cy_network)
|
String |
getNodeLabelAttribute()
Gets the name of the node attribute to which meta-node names should be assigned to, if not set, it is DEFAULT_NODE_LABEL_ATTRIBUTE |
boolean |
removeFromAttributes(CyNetwork cy_network,
CyNode node,
ArrayList children)
Removes all attributes created for the given meta-node. |
boolean |
removeMetaEdgesFromAttributes(CyNetwork cy_network,
CyNode metanode_root_index,
ArrayList children)
Remove attributes for the gicen meta-edges in CyNetwork, but leave the attributes for the meta-node as they are. |
boolean |
setAttributes(CyNetwork cy_network,
CyNode node,
ArrayList children,
AbstractIntIntMap meta_edge_to_child_edge)
Simply calls separate methods for nodes then edges |
boolean |
setEdgeAttributes(CyNetwork cy_network,
CyNode node,
AbstractIntIntMap meta_edge_to_child_edge)
Copies all edge attributes from child to meta edges |
boolean |
setNodeAttributes(CyNetwork cy_network,
CyNode node,
ArrayList children)
takes union of all children attributes, treating canonical and common name as special cases |
void |
setNodeLabelAttribute(String attribute_name)
Sets the name of the node attribute to which meta-node names should be assigned to, if not set, it is DEFAULT_NODE_LABEL_ATTRIBUTE |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected HashSet usedEdgeNames
protected String nodeLabelAttribute
Constructor Detail |
---|
public SimpleMetaNodeAttributesHandler()
Method Detail |
---|
public void setNodeLabelAttribute(String attribute_name)
setNodeLabelAttribute
in interface MetaNodeAttributesHandler
attribute_name
- the name of a node attribute of type String, if it is not of type
String, it is not setpublic String getNodeLabelAttribute()
getNodeLabelAttribute
in interface MetaNodeAttributesHandler
public String assignName(CyNetwork cy_net, CyNode node)
assignName
in interface MetaNodeAttributesHandler
cy_net
- the CyNetwork where the node is containednode
- the node
public boolean setAttributes(CyNetwork cy_network, CyNode node, ArrayList children, AbstractIntIntMap meta_edge_to_child_edge)
setAttributes
in interface MetaNodeAttributesHandler
cy_network
- the CyNetwork that contains the children nodes of the meta-nodenode
- the meta-nodechildren
- an array of CyNodes that are the children nodes of "node"meta_edge_to_child_edge
- maps a meta-edge (edge connected to the meta-node)
to a child edge (edge that connects a child of the meta-node to another
node) so that classes implementing this interface know which child edge
corresponds to which meta-edge
public boolean setNodeAttributes(CyNetwork cy_network, CyNode node, ArrayList children)
setNodeAttributes
in interface MetaNodeAttributesHandler
cy_network
- the CyNetwork that contains the children nodes of "node"node
- the node for which node attributes will be setchildren
- an ArrayList of CyNodes that are chilren nodes of the given node
public boolean setEdgeAttributes(CyNetwork cy_network, CyNode node, AbstractIntIntMap meta_edge_to_child_edge)
setEdgeAttributes
in interface MetaNodeAttributesHandler
cy_network
- the CyNetwork that contains the children nodes of "node"node
- the node for which edge attributes will be setmeta_edge_to_child_edge
- maps a meta-edge (edge connected to the meta-node)
to a child edge (edge that connects a child of the meta-node to another
node) so that classes implementing this interface know which child edge
corresponds to which meta-edge
public boolean removeFromAttributes(CyNetwork cy_network, CyNode node, ArrayList children)
MetaNodeAttributesHandler
removeFromAttributes
in interface MetaNodeAttributesHandler
cy_network
- were the children for the node livenode
- the meta-node
public boolean removeMetaEdgesFromAttributes(CyNetwork cy_network, CyNode metanode_root_index, ArrayList children)
MetaNodeAttributesHandler
removeMetaEdgesFromAttributes
in interface MetaNodeAttributesHandler
cy_network
- the CyNetwork where the meta-edges aremetanode_root_index
- the meta-nodechildren
- a list of CyEdges for which the attributes should be removed
protected String getCanonicalMetaName(CyNode node)
protected String getCommonMetaName(CyNode node, CyNetwork cy_network)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |