⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphgiubrowsegraph.m

📁 复杂网络的一些节点面对攻击的代码
💻 M
📖 第 1 页 / 共 4 页
字号:
GraphGUIBrowseGraphData.NodeDetailsEdit                                            =   NodeDetailsEdit;
GraphGUIBrowseGraphData.PathDetailsSlider                                       =   PathDetailsSlider;
GraphGUIBrowseGraphData.PathBrowserPanel                                          =   PathBrowserPanel;
GraphGUIBrowseGraphData.PathDetails                                                        =   PathDetails;
GraphGUIBrowseGraphData.BrowseDirectionPopup                                =    BrowseDirectionPopup ;
GraphGUIBrowseGraphData.SortDirectionToggleButton                   =   SortDirectionToggleButton;
GraphGUIBrowseGraphData.SearchNodeEdit                                                 =   SearchNodeEdit  ;
GraphGUIBrowseGraphData.SearchNodeButton                                            = SearchNodeButton ;

SetFont(fig);
%% Refresh controls:
GraphGIUBrowseGraph('GraphGIUBrowseGraph_VariablesListbox_ButtonDown',SelectedGraphPopup,[],guidata(SelectedGraphPopup));

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Figure_GraphGIUBrowseGraph_DeleteFcn(h, eventdata, handles, varargin)
global GraphGUIBrowseGraphData;
if ~isempty(GraphGUIBrowseGraphData)
    Properties  =   GraphGUIBrowseGraphData.Properties;
    [FilePath FileName] = fileparts(mfilename('fullpath'));
    save([FilePath '\' FileName '.mat'],'Properties');
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function GraphGIUBrowseGraph_FontSelectSelect_ButtonDown(h, eventdata, handles, varargin)
global GraphGUIBrowseGraphData;
if ~isempty(GraphGUIBrowseGraphData)
    NewFont = uisetfont(GraphGUIBrowseGraphData.Properties.Font);
    if isstruct(NewFont)
        GraphGUIBrowseGraphData.Properties.Font = NewFont;
        SetFont(h);
    end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Font = GetFont(h)
Font = [];
try
    Font.FontName   = get(h,'FontName');
    Font.FontUnits  = get(h,'FontUnits');
    Font.FontSize   = get(h,'FontSize');
    Font.FontWeight = get(h,'FontWeight');
    Font.FontAngle  = get(h,'FontAngle');
catch
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function SetFont(h)
fig         =   FigureHandle(h);
global GraphGUIBrowseGraphData;
if ~isempty(GraphGUIBrowseGraphData)
    % Data.Properties.FontName = 'FixedWidth';
    set(GraphGUIBrowseGraphData.NodeDetailsEdit,GraphGUIBrowseGraphData.Properties.Font);
    set(GraphGUIBrowseGraphData.SearchNodeEdit,GraphGUIBrowseGraphData.Properties.Font);
    for i = 1 : numel(GraphGUIBrowseGraphData.PathDetails.Elements)
        set(GraphGUIBrowseGraphData.PathDetails.Elements{i},GraphGUIBrowseGraphData.Properties.Font);
    end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Figure_GraphGIUBrowseGraph_ResizeFcn(h, eventdata, handles, varargin)
fig = FigureHandle(h);
global GraphGUIBrowseGraphData;
if ~isempty(GraphGUIBrowseGraphData)
    ScreenSize      =   get(0,'ScreenSize');
    FigureSize      =   get(fig,'Position');

    Sz = [1 FigureSize(4)-GraphGUIBrowseGraphData.Properties.ControlPanelHeight-1 FigureSize(3)-2 GraphGUIBrowseGraphData.Properties.ControlPanelHeight];
    set(GraphGUIBrowseGraphData.ControlsPanel,'Position',round(Sz));

    Sz = [1 FigureSize(4)-GraphGUIBrowseGraphData.Properties.PathPanelHeight-GraphGUIBrowseGraphData.Properties.ControlPanelHeight-2 FigureSize(3)-2 GraphGUIBrowseGraphData.Properties.PathPanelHeight];
    set(GraphGUIBrowseGraphData.PathPanel,'Position',round(Sz));

    Sz = get(GraphGUIBrowseGraphData.ControlsPanel,'Position');
    Sz = [Sz(3)-GraphGUIBrowseGraphData.Properties.ButtonSize(1)-GraphGUIBrowseGraphData.Properties.InterbuttonGap Sz(2) + (GraphGUIBrowseGraphData.Properties.ControlPanelHeight-GraphGUIBrowseGraphData.Properties.ButtonSize(2))/2 GraphGUIBrowseGraphData.Properties.ButtonSize(1) GraphGUIBrowseGraphData.Properties.ButtonSize(2)];
    set(GraphGUIBrowseGraphData.CloseButton,'Position',round(Sz));

    Sz = get(GraphGUIBrowseGraphData.ControlsPanel,'Position');
    Sz = [GraphGUIBrowseGraphData.Properties.InterbuttonGap Sz(2) + (GraphGUIBrowseGraphData.Properties.ControlPanelHeight-GraphGUIBrowseGraphData.Properties.PopupMenuSize(2))/2 GraphGUIBrowseGraphData.Properties.PopupMenuSize(1) GraphGUIBrowseGraphData.Properties.PopupMenuSize(2)];
    set(GraphGUIBrowseGraphData.SelectedGraphPopup   ,'Position',round(Sz));

    Sz = get(GraphGUIBrowseGraphData.SelectedGraphPopup,'Position');
    Sz = [Sz(1)+Sz(3)+1 Sz(2) GraphGUIBrowseGraphData.Properties.ButtonSize(1) GraphGUIBrowseGraphData.Properties.ButtonSize(2)];
    set(GraphGUIBrowseGraphData.VariablesListRefreshPushButton,'Position',round(Sz));

    Sz = get(GraphGUIBrowseGraphData.ControlsPanel,'Position');
    Sz2 = Sz(2) + (GraphGUIBrowseGraphData.Properties.ControlPanelHeight-GraphGUIBrowseGraphData.Properties.PopupMenuSize(2))/2;
    Sz = get(GraphGUIBrowseGraphData.VariablesListRefreshPushButton,'Position');
    Sz = [Sz(1)+Sz(3)+GraphGUIBrowseGraphData.Properties.InterbuttonGap Sz2 GraphGUIBrowseGraphData.Properties.PopupMenuSize(1) GraphGUIBrowseGraphData.Properties.PopupMenuSize(2)];
    set(GraphGUIBrowseGraphData.SortOrderPopup,'Position',round(Sz));

    Sz = get(GraphGUIBrowseGraphData.PathPanel,'Position');
    Sz = [FigureSize(3)-GraphGUIBrowseGraphData.Properties.DetailsPanelWidth-1 1 GraphGUIBrowseGraphData.Properties.DetailsPanelWidth FigureSize(4)-GraphGUIBrowseGraphData.Properties.PathPanelHeight-GraphGUIBrowseGraphData.Properties.ControlPanelHeight-4];
    set(GraphGUIBrowseGraphData.DetailsPanel,'Position',round(Sz));

    Sz = get(GraphGUIBrowseGraphData.DetailsPanel,'Position');
    Sz = [Sz(1)+1 Sz(2)+Sz(4)/2+1 Sz(3)-3 (Sz(4)-4)/2];
    set(GraphGUIBrowseGraphData.GraphDetailsEdit,'Position',round(Sz));

    Sz = get(GraphGUIBrowseGraphData.DetailsPanel,'Position');
    Sz = [Sz(1)+1 2 Sz(3)-3 (Sz(4)-4)/2];
    set(GraphGUIBrowseGraphData.NodeDetailsEdit,'Position',round(Sz));

    Sz = get(GraphGUIBrowseGraphData.DetailsPanel,'Position');
    Sz = [1 1 FigureSize(3)-3-Sz(3) GraphGUIBrowseGraphData.Properties.ScrollBarWidth];
    set(GraphGUIBrowseGraphData.PathDetailsSlider,'Position',round(Sz));

    Sz = get(GraphGUIBrowseGraphData.DetailsPanel,'Position');
    Sz = [1 GraphGUIBrowseGraphData.Properties.ScrollBarWidth+1 FigureSize(3)-3-Sz(3) Sz(4)-GraphGUIBrowseGraphData.Properties.ScrollBarWidth-2];
    set(GraphGUIBrowseGraphData.PathBrowserPanel,'Position',round(Sz));

    Sz = get(GraphGUIBrowseGraphData.ControlsPanel,'Position');
    Sz2 = Sz(2) + (GraphGUIBrowseGraphData.Properties.ControlPanelHeight-GraphGUIBrowseGraphData.Properties.ButtonSize(2))/2;
    Sz = get(GraphGUIBrowseGraphData.SortOrderPopup,'Position');
    Sz = [Sz(1)+Sz(3)+GraphGUIBrowseGraphData.Properties.InterbuttonGap Sz2 GraphGUIBrowseGraphData.Properties.ButtonSize(1)*1.5 GraphGUIBrowseGraphData.Properties.ButtonSize(2)];
    set(GraphGUIBrowseGraphData.SortDirectionToggleButton,'Position',round(Sz));
    
    Sz = get(GraphGUIBrowseGraphData.ControlsPanel,'Position');
    Sz2 = Sz(2) + (GraphGUIBrowseGraphData.Properties.ControlPanelHeight-GraphGUIBrowseGraphData.Properties.ButtonSize(2))/2;
    Sz = get(GraphGUIBrowseGraphData.SortDirectionToggleButton,'Position');
    Sz = [Sz(1)+Sz(3)+GraphGUIBrowseGraphData.Properties.InterbuttonGap Sz2 GraphGUIBrowseGraphData.Properties.ButtonSize(1) GraphGUIBrowseGraphData.Properties.ButtonSize(2)];
    set(GraphGUIBrowseGraphData.FontSelectPushbutton ,'Position',round(Sz));

    Sz   = get(GraphGUIBrowseGraphData.FontSelectPushbutton,'Position');
    Sz1  = Sz(1)+Sz(3) + GraphGUIBrowseGraphData.Properties.InterbuttonGap;
    Sz = get(GraphGUIBrowseGraphData.ControlsPanel,'Position');
    Sz = [Sz1 Sz(2) + (GraphGUIBrowseGraphData.Properties.ControlPanelHeight-GraphGUIBrowseGraphData.Properties.PopupMenuSize(2))/2 0.5*GraphGUIBrowseGraphData.Properties.PopupMenuSize(1) GraphGUIBrowseGraphData.Properties.PopupMenuSize(2)];
    set(GraphGUIBrowseGraphData.BrowseDirectionPopup,'Position',round(Sz)  );

    Sz   = get(GraphGUIBrowseGraphData.BrowseDirectionPopup ,'Position');
    Sz1  = Sz(1)+Sz(3) + GraphGUIBrowseGraphData.Properties.InterbuttonGap;
    Sz = get(GraphGUIBrowseGraphData.ControlsPanel,'Position');
    Sz = [Sz1 Sz(2) + (GraphGUIBrowseGraphData.Properties.ControlPanelHeight-GraphGUIBrowseGraphData.Properties.ButtonSize(2))/2 GraphGUIBrowseGraphData.Properties.ButtonSize(1) GraphGUIBrowseGraphData.Properties.ButtonSize(2)];
    set(GraphGUIBrowseGraphData.SearchNodeEdit,'Position',round(Sz));

    Sz   = get(GraphGUIBrowseGraphData.SearchNodeEdit,'Position');
    Sz1  = Sz(1)+Sz(3) ;
    Sz = get(GraphGUIBrowseGraphData.ControlsPanel,'Position');
    Sz = [Sz1 Sz(2) + (GraphGUIBrowseGraphData.Properties.ControlPanelHeight-GraphGUIBrowseGraphData.Properties.ButtonSize(2))/2 GraphGUIBrowseGraphData.Properties.ButtonSize(1) GraphGUIBrowseGraphData.Properties.ButtonSize(2)];
    set(GraphGUIBrowseGraphData.SearchNodeButton ,'Position',round(Sz));

    Sz = get(GraphGUIBrowseGraphData.PathBrowserPanel,'Position');
    for i = 1 : numel(    GraphGUIBrowseGraphData.PathDetails.Elements  )
        CurrentSz  = get(GraphGUIBrowseGraphData.PathDetails.Elements{i},'Position');
        CurrentSz(4) = Sz(4)-3-GraphGUIBrowseGraphData.Properties.ButtonSize(2);
        set(GraphGUIBrowseGraphData.PathDetails.Elements{i},'Position',round(CurrentSz));
        Visibility = SetChildVisibility(GraphGUIBrowseGraphData.PathBrowserPanel,GraphGUIBrowseGraphData.PathDetails.Elements{i});
        set(GraphGUIBrowseGraphData.PathDetails.ScrollButtons{1,i},'Visible',Visibility);
        set(GraphGUIBrowseGraphData.PathDetails.ScrollButtons{2,i},'Visible',Visibility);
        set(GraphGUIBrowseGraphData.PathDetails.Text{i},'Visible',Visibility);
    end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Visibility = SetChildVisibility(Parent,Child)
try
    ParentSz = get(Parent,'Position');
    ChildSz = get(Child,'Position');
    if ChildSz(1)+ChildSz(3) > ParentSz(1) & ChildSz(1)+ChildSz(3) <= ParentSz(1) +ParentSz(3)
        Visibility = 'on';
    else
        Visibility  = 'off';
    end
catch
    Visibility = 'off';
end
set(Child,'Visible',Visibility);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function GraphGIUBrowseGraph_CloseButton_Click(h, eventdata, handles, varargin)
fig = FigureHandle(h);
if ~isempty(fig)
    % uiresume(fig);
    delete(fig);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function GraphGIUBrowseGraph_VariablesListbox_ButtonDown(h, eventdata, handles, varargin)
fig = FigureHandle(h);
global GraphGUIBrowseGraphData;
if ~isempty(fig)
    if ~isempty(GraphGUIBrowseGraphData)
        CurrentSelection = GetVariable(fig);
    end
    GraphVariables = GraphGetGraphVariables();
    set(GraphGUIBrowseGraphData.SelectedGraphPopup,'String',GraphVariables);
    SetVariable(fig,CurrentSelection );

    %% Set sort order:
    SelectedSortOrderList = get(GraphGUIBrowseGraphData.SortOrderPopup,'String');
    SelectedSortOrder = SelectedSortOrderList{get(GraphGUIBrowseGraphData.SortOrderPopup,'Value')};
    SelectedSortOrderList = { 'ID', 'Name' };
    for i = 1 : evalin('base',['numel(' GetVariable(fig) '.Index.Properties)'])
        SelectedSortOrderList{end+1} = evalin('base',[ GetVariable(fig) '.Index.Properties(' num2str(i) ').PropertyName']);
    end
    set(GraphGUIBrowseGraphData.SortOrderPopup,'String',SelectedSortOrderList);
    Index = strmatch(SelectedSortOrder,SelectedSortOrderList,'exact');
    if isempty(Index)
        Index = 1;
    end
    set(GraphGUIBrowseGraphData.SortOrderPopup,'Value',Index);

    %% Set Graph Details:
    set(GraphGUIBrowseGraphData.GraphDetailsEdit,'String',GetGraphDetails(fig));
    %% Set node details:
    Selected = GetVariable(h);
    ClearPath(fig);

    GraphGUIBrowseGraphData.PathDetails.NodeIDs = evalin('base',['GraphNodeIDs(' Selected ')']);
    GraphGUIBrowseGraphData.PathDetails.NodeNames = evalin('base',['GraphGetNodeNames(' Selected ',GraphNodeIDs(' Selected '))']);
    % evalin('base',[ 'strcat(GraphGetNodeNames(' Selected ',GraphNodeIDs(' Selected ')), ''   ('', num2str( GraphNodeIDs(' Selected ')),'')'')' ]);

    % Sort nodes... - not implemented yet
    SortOrder = GetSortOrder(h);
    if ~isempty(SortOrder)
        GraphGUIBrowseGraphData.PathDetails.NodeIDs = GraphGUIBrowseGraphData.PathDetails.NodeIDs (SortOrder);
        if ~isempty(GraphGUIBrowseGraphData.PathDetails.NodeNames)
            GraphGUIBrowseGraphData.PathDetails.NodeNames = GraphGUIBrowseGraphData.PathDetails.NodeNames (SortOrder);
        else
            GraphGUIBrowseGraphData.PathDetails.NodeNames = num2str(GraphGUIBrowseGraphData.PathDetails.NodeIDs);
        end
    end
    if numel(GraphGUIBrowseGraphData.PathDetails.NodeIDs)
        AddNodeToPath(fig,[]);
    end
end
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function GraphGIUBrowseGraph_SortDirection_ToggleButton(h, eventdata, handles, varargin)
GraphGIUBrowseGraph_SortOrderSelect_ButtonDown(h, eventdata, handles, varargin)
try
    global GraphGUIBrowseGraphData;
    if ~isempty(GraphGUIBrowseGraphData)
        if get(GraphGUIBrowseGraphData.SortDirectionToggleButton,'Value')==0
            set(GraphGUIBrowseGraphData.SortDirectionToggleButton,'String','Now: Descending');
        else
            set(GraphGUIBrowseGraphData.SortDirectionToggleButton,'String','Now: Ascending');
        end
    end
catch
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function GraphGIUBrowseGraph_BrowseDirectionbox_ButtonDown(h, eventdata, handles, varargin)
GraphGIUBrowseGraph_SortOrderSelect_ButtonDown(h, eventdata, handles, varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -