Matlab--biograph() 函数

本文翻译自MATLAB的help文档。 


biograph函数生成一个bioinformatics图对象。


BG = biograph(CM) 这条语句生成一个图对象BG,参数CM是这个图的邻接矩阵(CM可以是稀疏矩阵形式表示也可以是一般方阵形式)。CM中所有非对角线元素以及非零元素表示图中连接的节点,矩阵的行表示起始节点,列表式汇聚节点。注意IDs默认是行或列的序号。

 

 BG = biograph(CM,IDs) 这条语句设置节点的序号名称。IDs可以使一个元胞数组,数组中每个元素表示一个名字,数组长度与CM矩阵行列长度一致。IDs也可以是一个字符数组(此时各个节点的名字长度相同)。IDs必须是唯一的,不能重复。


 一个图可以在没有几何信息的情况下存在,这时他只需要节点的连接情况信息。然而将一个图转化成一个HG figure(不知道怎么翻译),节点的位置以及边的弯曲形状都需要用DOLAYOUT方法进行计算。DOLAYOUT这个方法通过计算缺失对象属性来使得画出来的网络图形更清晰有条理。


 一个biograph 对象具有公有的或者私有的属性。例如私有属性the edge control points描绘链接节点的线条形状。

可以通过GET或者SET方法来操作公有属性,或者利用点属性(.)操作。


 当一个biograph 已经转化为一个HG figure,你可以改变这个figure的公有属性。这时该figure的公有属性会自动更新,除了那些鱼DOLAYOUT方法有交互的属性之外。在这种情况下你需要调用DOLAYOUT方法或者鼠标右键内容菜单来人工设置layout。

 
    PUBLIC PROPERTIES OF THE biograph OBJECT:
 
    1) LAYOUT PROPERTIES:
 
    ID:              User defined character string.
    Label:           User defined character string.
    Description:     User defined character string.
    LayoutType:      Select the type of algorithm for the layout engine.
                     Options are 'hierarchical' (default), 'radial' and
                     'equilibrium'.
    LayoutScale:     A positive number to scale the size of the nodes before
                     calling the layout engine.
    Scale:           A positive number to post-scale the node coordinates.
    NodeAutoSize:    'on' (default) or 'off' to turn on/off the
                     pre-calculation of the node size before calling the
                     layout engine. 
    ShowTextInNodes: Selects which node property is shown in the layout.
                     Options are 'label' (default), 'id' and 'none'.
    EdgeType:        Type of edges, it can be 'curved' (default),
                     'segmented' or 'straight'. Curved or segmented edges
                     occur only when necessary to avoid obstruction by
                     nodes. 'Equilibrium' and 'Radial' layout types cannot
                     produce curved or segmented edges. 
    EdgeTextColor:   RGB three element numeric vector, defaults to [0 0 0].
    ShowArrows:      'on' (default) or 'off' to show/hide arrows of the
                     edges.
    ArrowSize:       Sets the size of the arrows, defaults to 8 (pts).
    ShowWeights:     'on' (default) or 'off' to show/hide text indicating
                     the weight of the edges.
    EdgeFontSize:    Positive number, defaults to 8 (pts).
    NodeCallback:    Name of function or function handle for the user
                     callback for all nodes (defaults to 
                     @(node) inspect(node)). 
    EdgeCallback:    Name of function or function handle for the user
                     callback for all edges (defaults to
                     @(edge) inspect(edge)). 
    CustomNodeDrawFcn: Function handle to customized function to draw
                     nodes, defaults to [].
    Nodes:           Vector with handles to nodes (read only).
    Edges:           Vector with handles to edges (read only).
 
    2) NODE PROPERTIES:
 
    ID:          Character string defined when the biograph object is
                 created. Node IDs must be unique.
    Label:       User defined character string, defaults to an empty string
                 when the node is created. 
    Description: User defined character string, defaults to an empty string
                 when the node is created.
    Position:    Defaults to [], automatically computed by the layout
                 engine.
    Shape:       Defaults to 'box', other options are 'ellipse', 'circle',
                 'rect', 'rectangle', 'diamond', 'trapezium', 'house',
                 'invtrapezium', 'invhouse', and, 'parallelogram'.
    Size:        Defaults to [10 10], automatically computed before calling
                 the layout engine using the current font size and shape of
                 the node.
    Color:       RGB three element numeric vector, defaults to [1 1 0.7].
    LineWidth:   Positive number, defaults to 1.
    LineColor:   RGB three element numeric vector, defaults to [0.3 0.3 1].
    FontSize:    Positive number, defaults to 8 points.
    TextColor:   RGB three element numeric vector, defaults to [0 0 0].
    UserData:    User data container, defaults to [].
 
    3) EDGE PROPERTIES:
 
    ID:          Character string. Edge IDs are automatically generated from
                 the node IDs. Edge IDs may be modified as long as the IDs
                 are unique. 
    Label:       User defined character string, defaults to an empty string.
    Description: User defined string, defaults to an empty string.
    Weight:      User defined value, defaults to 1, 
    LineWidth:   Positive number, defaults to 1.
    LineColor:   RGB three element numeric vector, defaults to 
                 [0.5 0.5 0.5]. 
    UserData:    User data container, defaults to [].
 

 例子:


        % Create a biograph object.
        cm = [0 1 1 0 0;1 0 0 1 1;1 0 0 0 0;0 0 0 0 1;1 0 1 0 0];
        bg1 = biograph(cm)

        get(bg1.nodes,'ID')

        view(bg1)

  
        % Create a biograph object and assign the node IDs.
        cm = [0 1 1 0 0;1 0 0 1 1;1 0 0 0 0;0 0 0 0 1;1 0 1 0 0];
        ids = {'M30931','L07625','K03454','M27323','M15390'};
        bg2 = biograph(cm,ids)

        get(bg2.nodes,'ID')

        view(bg2)


评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值