Description of graph6 and sparse6 encodings

本文详细介绍了Graph6和Sparse6两种图形编码格式。Graph6适用于简单无向图,而Sparse6则支持更广泛的图类型,包括带环和多重边的无向图。文章深入解析了这两种格式的数据类型、编码方式及文件结构,并提供了实例说明。
Description of graph6 and sparse6 encodings
-------------------------------------------
Brendan McKay, bdm@cs.anu.edu.au
Updated Jul 2014.

General principles:

  All numbers in this description are in decimal unless obviously 
  in binary.

  Apart from the header, there is one object per line. Apart from
  the header, end-of-line characters, and the characters ":" and
  ";" which might start a line, all bytes have a value in the range
  63-126 (which are all printable ASCII characters). A file of
  objects is a text file, so whatever end-of-line convention is
  locally used is fine).

Bit vectors:

  A bit vector x of length k can be represented as follows.  
      Example:  1000101100011100

  (1) Pad on the right with 0 to make the length a multiple of 6.
      Example:  100010110001110000

  (2) Split into groups of 6 bits each.
      Example:  100010 110001 110000

  (3) Add 63 to each group, considering them as bigendian binary numbers.
      Example:  97 112 111

  These values are then stored one per byte.  
  So, the number of bytes is ceiling(k/6).

  Let R(x) denote this representation of x as a string of bytes.
      
Small nonnegative integers:
 
  Let n be an integer in the range 0-68719476735 (2^36-1).

  If 0 <= n <= 62, define N(n) to be the single byte n+63.
  If 63 <= n <= 258047, define N(n) to be the four bytes
      126 R(x), where x is the bigendian 18-bit binary form of n.
  If 258048 <= n <= 68719476735, define N(n) to be the eight bytes
      126 126 R(x), where x is the bigendian 36-bit binary form of n.

  Examples:  N(30) = 93
             N(12345) = N(000011 000000 111001) = 126 66 63 120
             N(460175067) = N(000000 011011 011011 011011 011011 011011)
                          = 126 126 63 90 90 90 90 90


Description of graph6 format.
----------------------------

Data type:  
   simple undirected graphs of order 0 to 68719476735.

Optional Header: 
   >>graph6<<     (without end of line!)

File name extension:
   .g6

One graph:
   Suppose G has n vertices.  Write the upper triangle of the adjacency
   matrix of G as a bit vector x of length n(n-1)/2, using the ordering
   (0,1),(0,2),(1,2),(0,3),(1,3),(2,3),...,(n-1,n).

   Then the graph is represented as  N(n) R(x).

Example:
   Suppose n=5 and G has edges 0-2, 0-4, 1-3 and 3-4.

   x = 0 10 010 1001
    
   Then N(n) = 68 and R(x) = R(010010 100100) = 81 99.
   So, the graph is  68 81 99.


Description of sparse6 format.
------------------------------

Data type:
   Undirected graphs of order 0 to 68719476735.
   Loops and multiple edges are permitted.

Optional Header:
   >>sparse6<<     (without end of line!)

File name extension:
   .s6

General structure:

  Each graph occupies one text line. Except for the first character
  and end-of-line characters, each byte has the form 63+x, where 
  0 <= x <= 63. The byte encodes the six bits of x.

  The encoded graph consists of:
	(1) The character ':'.   (This is present to distinguish
                                  the code from graph6 format.)
        (2) The number of vertices.
        (3) A list of edges.
        (4) end-of-line

  Loops and multiple edges are supported, but not directed edges.

Number of vertices n:

  1, 4, or 8 bytes N(n) as above.
  This is the same as graph6 format.

List of edges:

  Let k be the number of bits needed to represent n-1 in binary.
  
  The remaining bytes encode a sequence 

      b[0] x[0] b[1] x[1] b[2] x[2] ... b[m] x[m]

  Each b[i] occupies 1 bit, and each x[i] occupies k bits.
  Pack them together in bigendian order, and pad up to a
  multiple of 6 as follows:
  1. If (n,k) = (2,1), (4,2), (8,3) or (16,4), and vertex
     n-2 has an edge but n-1 doesn't have an edge, and
     there are k+1 or more bits to pad, then pad with one
     0-bit and enough 1-bits to complete the multiple of 6.
  2. Otherwise, pad with enough 1-bits to complete the
     multiple of 6.
  These rules are to match the gtools procedures, and to avoid
  the padding from looking like an extra loop in unusual cases.

  Then represent this bit-stream 6 bits per byte as indicated above.

  The vertices of the graph are 0..n-1.
  The edges encoded by this sequence are determined thus:

     v = 0
     for i from 0 to m do
        if b[i] = 1 then v = v+1 endif;
        if x[i] > v then v = x[i] else output {x[i],v} endif
     endfor

   In decoding, an incomplete (b,x) pair at the end is discarded.

Example:

  :Fa@x^

  ':' indicates sparse6 format.
  Subtract 63 from the other bytes and write them in binary, 
  six bits each.

   000111 100010 000001 111001 011111

  The first byte is not 63, so it is n.  n=7
  n-1 needs 3 bits (k=3).  Write the other bits in groups
  of 1 and k:

    1 000  1 000  0 001  1 110   0 101  1 111
  
    This is the b/x sequence  1,0 1,0 0,1 1,6 0,5 1,7.
    The 1,7 at the end is just padding.
    The remaining parts give the edges 0-1 0-2 1-2 5-6.


Description of incremental sparse6 format.
-----------------------------------------

  This is an extension to sparse6 format that is very efficient if most
  graphs in a file are similar to the previous graph.

  Each graph occupies one text line. Except for the first character
  and end-of-line characters, each byte has the form 63+x, where 
  0 <= x <= 63. The byte encodes the six bits of x.

  The encoded graph consists of:
	(1) The character ';'.
        (2) A list of edges.
        (3) end-of-line

  This cannot appear as the first graph in a file.  The number of vertices
  is taken to be equal to the number of vertices in the previous graph.
  The list of edges specifies the symmetric difference of this graph and
  the previous graph.  It is encoded exactly the same as part (3) of
  sparse6 format.

  Loops are supported, but not multiple edges.
【事件触发一致性】研究多智能体网络如何通过分布式事件驱动控制实现有限时间内的共识(Matlab代码实现)内容概要:本文围绕多智能体网络中的事件触发一致性问题,研究如何通过分布式事件驱动控制实现有限时间内的共识,并提供了相应的Matlab代码实现方案。文中探讨了事件触发机制在降低通信负担、提升系统效率方面的优势,重点分析了多智能体系统在有限时间收敛的一致性控制策略,涉及系统模型构建、触发条件设计、稳定性与收敛性分析等核心技术环节。此外,文档还展示了该技术在航空航天、电力系统、机器人协同、无人机编队等多个前沿领域的潜在应用,体现了其跨学科的研究价值和工程实用性。; 适合人群:具备一定控制理论基础和Matlab编程能力的研究生、科研人员及从事自动化、智能系统、多智能体协同控制等相关领域的工程技术人员。; 使用场景及目标:①用于理解和实现多智能体系统在有限时间内达成一致的分布式控制方法;②为事件触发控制、分布式优化、协同控制等课题提供算法设计与仿真验证的技术参考;③支撑科研项目开发、学术论文复现及工程原型系统搭建; 阅读建议:建议结合文中提供的Matlab代码进行实践操作,重点关注事件触发条件的设计逻辑与系统收敛性证明之间的关系,同时可延伸至其他应用场景进行二次开发与性能优化。
【四旋翼无人机】具备螺旋桨倾斜机构的全驱动四旋翼无人机:建模与控制研究(Matlab代码、Simulink仿真实现)内容概要:本文围绕具备螺旋桨倾斜机构的全驱动四旋翼无人机展开,重点研究其动力学建模与控制系统设计。通过Matlab代码与Simulink仿真实现,详细阐述了该类无人机的运动学与动力学模型构建过程,分析了螺旋桨倾斜机构如何提升无人机的全向机动能力与姿态控制性能,并设计相应的控制策略以实现稳定飞行与精确轨迹跟踪。文中涵盖了从系统建模、控制器设计到仿真验证的完整流程,突出了全驱动结构相较于传统四旋翼在欠驱动问题上的优势。; 适合人群:具备一定控制理论基础和Matlab/Simulink使用经验的自动化、航空航天及相关专业的研究生、科研人员或无人机开发工程师。; 使用场景及目标:①学习全驱动四旋翼无人机的动力学建模方法;②掌握基于Matlab/Simulink的无人机控制系统设计与仿真技术;③深入理解螺旋桨倾斜机构对飞行性能的影响及其控制实现;④为相关课题研究或工程开发提供可复现的技术参考与代码支持。; 阅读建议:建议读者结合提供的Matlab代码与Simulink模型,逐步跟进文档中的建模与控制设计步骤,动手实践仿真过程,以加深对全驱动无人机控制原理的理解,并可根据实际需求对模型与控制器进行修改与优化。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值