Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.io
Class PartitionDecorationReader

    java.lang.Object
      edu.uci.ics.jung.io.PartitionDecorationReader

public class PartitionDecorationReader
extends Object

Reads decorations for vertices in a specified partition from a `Reader`.

Author:
  Joshua O'Madadhain

Constructor Summary
`PartitionDecorationReader()`

Method Summary
`static int` | `loadCounts(Graph bg, Reader count_reader, Predicate partition, Object count_key, UserDataContainer.CopyAction copyact)` Decorates vertices in the specified partition with typed count data.
`static void` | `loadCounts(Graph bg, Reader count_reader, Predicate partition, Object count_key, UserDataContainer.CopyAction copyact, int num_types)`
`static void` | `loadStrings(Graph bg, Reader name_reader, Predicate partition, Object string_key)` Decorates vertices in the specified partition with strings.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PartitionDecorationReader

    public PartitionDecorationReader()

Method Detail

### loadStrings

    public static void loadStrings(Graph bg,
                                   Reader name_reader,
                                   Predicate partition,
                                   Object string_key)

  Decorates vertices in the specified partition with strings. The decorations are specified by a text file with the following format:

       vid_1 label_1
       vid_2 label_2 ...

  The strings must be unique within this partition; duplicate strings will cause a `UniqueLabelException` to be thrown.

  The end of the file may be artificially set by putting the string `end_of_file` on a line by itself.

  Parameters:
    `bg` - the bipartite graph whose vertices are to be decorated
    `name_reader` - the reader containing the decoration information
    `partition` - the vertex partition whose decorations are specified by this file
    `string_key` - the user data key for the decorations created

### loadCounts

    public static int loadCounts(Graph bg,
                                 Reader count_reader,
                                 Predicate partition,
                                 Object count_key,
                                 UserDataContainer.CopyAction copyact)

  Decorates vertices in the specified partition with typed count data. The data must be contained in a text file in the following format:

       vid_1    type_1  count_1
       vid_2    type_2  count_2
       ...

  where `count_i` (an integer value) represents the number of elements of type `type_i` possessed by the vertex with ID `vid_i` (as defined by `BipartiteGraphReader.load()`) for the `i`th line in the file.

  For example, the vertices might represent authors, the type might represent a topic, and the count might represent the number of papers that the specified author had written on that topic.

  If `normalize` is `true`, then the count data will be scaled so that the counts for each vertex will sum to 1. (In this case, each vertex must have a positive total count value.)

  The end of the file may be artificially set by putting the string `end_of_file` on a line by itself.

  Parameters:
    `bg` - the bipartite graph whose vertices are to be decorated
    `count_reader` - the reader containing the decoration data
    `partition` - the partition whose decorations are specified by this file
    `count_key` - the user key for the decorations
    `copyact` - the copy action for the decorations
  Returns:
    the total number of types observed

### loadCounts

    public static void loadCounts(Graph bg,
                                  Reader count_reader,
                                  Predicate partition,
                                  Object count_key,
                                  UserDataContainer.CopyAction copyact,
                                  int num_types)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD