Character Dependency Graphs

IDS data is converted/represented as a graph where the vertices are components and the directed edges point from larger characters to the components of the characters. This graph type fully implements the AbstractGraph interface specified in Graphs. An IDSGraph is also indexable, which returns the character structure of that character.

IDSGraphs.IDSGraphType
IDSGraph([input])

Create a graph representation of IDS data; if no input is provided, an empty graph will be created. The input can be a symbol representing a dataset to load, or it can be something readable by eachline.

Available IDS Datasets

  • :ids - the default IDS file
source

Besides the functionality in Graphs.jl, there are a few other functions provided to work with the graph structure:

IDSGraphs.componentsFunction
components(idsgraph, char)

The components that make up a character.

Examples

julia> g = IDSGraph(:ids);

julia> collect(components(g, '㲉'))
5-element Vector{Char}:
 '一': Unicode U+4E00 (category Lo: Letter, other)
 '冖': Unicode U+5196 (category Lo: Letter, other)
 '士': Unicode U+58EB (category Lo: Letter, other)
 '殳': Unicode U+6BB3 (category Lo: Letter, other)
 '卵': Unicode U+5375 (category Lo: Letter, other)
source
IDSGraphs.compoundsFunction
compounds(idsgraph, char)

The characters that are compounds of the given character.

Examples

julia> g = IDSGraph(:ids);

julia> collect(compounds(g, '毛'))
529-element Vector{Char}:
 '兞': Unicode U+515E (category Lo: Letter, other)
 '尾': Unicode U+5C3E (category Lo: Letter, other)
 '宒': Unicode U+5B92 (category Lo: Letter, other)
 '毳': Unicode U+6BF3 (category Lo: Letter, other)
 '旄': Unicode U+65C4 (category Lo: Letter, other)
 '枆': Unicode U+6786 (category Lo: Letter, other)
 ⋮
 '𭴎': Unicode U+2DD0E (category Lo: Letter, other)
 '𭸶': Unicode U+2DE36 (category Lo: Letter, other)
 '𮁠': Unicode U+2E060 (category Lo: Letter, other)
 '𮊐': Unicode U+2E290 (category Lo: Letter, other)
 '𮗥': Unicode U+2E5E5 (category Lo: Letter, other)
source
IDSGraphs.subgraphFunction
subgraph(condition, idsgraph)

Create a subgraph keeping only vertices v where condition(v) == true.

source