// ----------------------------------------------------------------------------------------
  // is this called from anywhere? doesn't look like it
  public void createAndBroadcastNetwork(
      String sourceNode, String[] targetNodes, double[] weights, String[] targetTypes) {
    // System.out.println ("createAndBroadcastNetwork, source: " + sourceNode);
    Network network = new Network();
    addMetaDataToNetwork(network);
    network.setSpecies(defaultSpecies);

    for (int i = 0; i < targetNodes.length; i++) {
      Interaction interaction = new Interaction(sourceNode, targetNodes[i], targetTypes[i]);
      network.add(interaction);
      String edgeName = sourceNode + " (" + targetTypes[i] + ") " + targetNodes[i];
      // System.out.println ("adding weight " + weights [i] + " for edge " + edgeName);
      network.addEdgeAttribute(edgeName, "weight", weights[i]);
    }

    try {
      gaggleBoss.broadcastNetwork(myGaggleName, targetGoose, network);
    } catch (RemoteException rex) {
      System.err.println("error broadcasting network from RShellGoose " + myGaggleName);
      rex.printStackTrace();
    }
  } // createAndBroadcastNetwork
  /**
   * a network is a collection of (possibly degenerate) interactions. the R client should pass 3
   * arrays of strings, having the following structure
   *
   * <p>edges consist of strings like "VNG0723G::VNG1233G::PhylogeneticProfile" node attributes:
   * "VNG1233G::commonName::pepq2" edge attributes:
   * "VNG0723G::VNG1233G::PhylogeneticProfile::confidence::0.533"
   */
  public void createAndBroadcastNetwork(
      String[] interactionStrings,
      String[] nodeAttributeStrings,
      String[] edgeAttributeStrings,
      String name) {

    Network network = new Network();
    addMetaDataToNetwork(network);
    network.setName(name);
    network.setSpecies(defaultSpecies);

    for (String interactionString : interactionStrings) {
      String[] tokens = interactionString.split("::");
      int tokenCount = tokens.length;
      // for (int t=0; t < tokens.length; t++)
      //  System.out.println ("  edge token " + t + ": " + tokens [t]);
      if (tokenCount == 1 && tokens[0].trim().length() > 0) {
        // System.out.println ("adding one orphan node to network: " + tokens [0]);
        network.add(tokens[0]);
      } else if (tokenCount == 3) {
        String sourceNode = tokens[0];
        String targetNode = tokens[1];
        String interactionType = tokens[2];
        network.add(new Interaction(sourceNode, targetNode, interactionType));
      } // else:  good interaction
    } // for i

    // System.out.println ("nodeAttributeStrings count: " + nodeAttributeStrings.length);
    for (String nodeAttributeString : nodeAttributeStrings) {
      // System.out.println ("   " + nodeAttributeStrings [i]);
      String[] tokens = nodeAttributeString.split("::");
      if (tokens.length == 3) {
        String nodeName = tokens[0].trim();
        String attributeName = tokens[1].trim();
        String rawValue = tokens[2].trim();
        Object value = StringToObjectConverter.convert(rawValue);
        network.addNodeAttribute(nodeName, attributeName, value);
      } // if 3 tokens
    } // for i

    // System.out.println ("edgeAttributeStrings count: " + edgeAttributeStrings.length);
    for (String edgeAttributeString : edgeAttributeStrings) {
      // System.out.println ("   " + edgeAttributeStrings [i]);
      String[] tokens = edgeAttributeString.split("::");
      if (tokens.length == 5) {
        String sourceNode = tokens[0].trim();
        String targetNode = tokens[1].trim();
        String edgeType = tokens[2].trim();
        String attributeName = tokens[3].trim();
        String rawValue = tokens[4].trim();
        Object value = StringToObjectConverter.convert(rawValue);
        String edgeName = sourceNode + " (" + edgeType + ") " + targetNode;
        network.addEdgeAttribute(edgeName, attributeName, value);
      } // if 5 tokens
    } // for i

    // System.out.println ("RShellGoose, about to broadcast network");
    // System.out.println ("     node count: " + network.getNodes().length);
    // System.out.println ("      connected: " + network.getConnectedNodes ().size ());
    // System.out.println ("         orphan: " + network.getOrphanNodes().length);

    try {
      gaggleBoss.broadcastNetwork(myGaggleName, targetGoose, network);
    } catch (RemoteException rex) {
      System.err.println("error broadcasting network from RShellGoose " + myGaggleName);
      rex.printStackTrace();
    }
  } // createAndBroadcastNetwork