UltipaDocs
Try Playground
  • Introduction
    • Show Algorithms
    • Install and Uninstall
    • Run Algorithms
    • Algorithm Results and Statistics
    • Degree Centrality
    • Closeness Centrality
    • Harmonic Centrality
    • Graph Centrality
    • Betweenness Centrality
    • Eigenvector Centrality
    • CELF
    • PageRank
    • ArticleRank
    • HITS
    • SybilRank
    • Jaccard Similarity
    • Overlap Similarity
    • Cosine Similarity
    • Pearson Correlation Coefficient
    • Euclidean Distance
    • K-Hop All
    • Bipartite Graph
    • HyperANF
    • Connected Component
    • Triangle Counting
    • Induced Subgraph
    • k-Core
    • k-Truss
    • p-Cohesion
    • k-Edge Connected Components
    • Local Clustering Coefficient
    • Topological Sort
    • Schema Overview
    • Dijkstra's Single-Source Shortest Path
    • Delta-Stepping Single-Source Shortest Path
    • Shortest Path Faster Algorithm (SPFA)
    • Minimum Spanning Tree
    • Breadth-First Search (BFS)
    • Depth-First Search (DFS)
    • Adamic-Adar Index
    • Common Neighbors
    • Preferential Attachment
    • Resource Allocation
    • Total Neighbors
    • Louvain
    • Leiden
    • Label Propagation
    • HANP
    • k-Means
    • kNN (k-Nearest Neighbors)
    • K-1 Coloring
    • Conductance
      • Random Walk
      • Node2Vec Walk
      • Node2Vec
      • Struc2Vec Walk
      • Struc2Vec
      • GraphSAGE
      • GraphSAGE Train
      • LINE
      • Fast Random Projection
      • Summary of Graph Embedding
      • Gradient Descent
      • Backpropagation
      • Skip-gram
      • Skip-gram Optimization
  1. Docs
  2. /
  3. Graph Analytics & Algorithms
  4. /
  5. Community Detection & Classification

K-1 Coloring

✓ File Writeback ✓ Property Writeback ✓ Direct Return ✓ Stream Return ✓ Stats

Overview

The K-1 Coloring algorithm assigns colors to each node such that no two adjacent nodes share the same color and the number of colors used is minimized.

  • Graph Coloring Algorithms for Multi-core and Massively Multithreaded Architectures (2018)

Concepts

Coloring

A coloring of a graph often refers to a proper node coloring, namely a labeling of the graph's nodes with colors such that no two nodes sharing the same edge have the same color. Graph coloring is a fundamental problem in computer science used in applications such as scheduling, register allocation, and wireless channel assignment.

Chromatic Number

The smallest number of colors needed to color a graph G is called its chromatic number, and is often denoted χ(G). A graph that can be assigned a (proper) k-coloring is k-colorable, and it is k-chromatic if its chromatic number is exactly k.

Considerations

Graph coloring is NP-complete It is NP-complete to decide if a given graph admits a k-coloring and NP-hard to compute the chromatic number. As a result, greedy algorithm is often used to solve graph coloring problem for large graphs. In fact, such approach does not guarantee the optimal solution and may color neighboring nodes the same. However, increasing the number of iterations can improve accuracy.

Syntax

  • Command: algo(k1_coloring)
  • Parameters:
Name
Type
Spec
Default
Optional
Description
loop_numint>=15YesNumber of iterations
versionint1, 22Yes1 for serial greedy coloring algorithm, 2 for iterative parallel greedy coloring algorithm

Examples

The example graph is as follows:

File Writeback

SpecContentDescription
filename_community_id_id,community_idNode and its community ID
filename_idscommunity_id,_id,_id,...Community ID and the ID of nodes in it
filename_numcommunity_id,countCommunity ID and the number of nodes in it

Property Writeback

SpecContentWrite toData Type
propertycommunity_idNode propertyuint32??? 不是string吗

Direct Return

Alias Ordinal
Type
Description
Columns
0[]perNodeNode and its community ID_uuid, community_id
1KVNumber of communities, modularitycommunity_count, modularity

Stream Return

SpecContentAlias OrdinalTypeDescriptionColumns
mode1 or if not set0[]perNodeNode and its community ID_uuid, community_id
2[]perCommunityCommunity and the number of nodes in itcommunity_id, count

Stats Return

Alias Ordinal
Type
DescriptionColumns
0KVNumber of communitiescommunity_count