当前位置:网站首页>Code source de la fonction [analogique numérique] MATLAB allcycles () (non disponible avant 2021a)
Code source de la fonction [analogique numérique] MATLAB allcycles () (non disponible avant 2021a)
2022-07-07 04:40:00 【Dream of Grass】
Matlaballcycles()
Code source de la fonction
Dans ce billet précédentTous les cercles dirigés d'un digraphe sont obtenus par le programme(Anneau dirigé)Et visualiserIl y a unallcycles
Fonctions,Cette fonction n'a que2021aC'est vrai.,SimatlabCette fonction ne peut pas être utilisée sans une version plus élevée,Donc pour que tout le monde puisse l'utiliser,J'ai misallcycles
Trouver la fonction intégrée et la partager avec tout le monde.
function [cycles, edgecycles] = allcycles(G, varargin)
% ALLCYCLES Compute all cycles in digraph
% CYCLES = ALLCYCLES(G) computes all the cycles in digraph G. CYCLES is a
% cell array in which CYCLES{
i} is a vector of numeric node IDs (if G
% does not have node names) or a cell array of character vectors (if G
% has node names). Each cycle in CYCLES begins with the smallest node
% index. If G is acyclic, then CYCLES is empty. The cycles are in
% lexicographical order.
%
% [CYCLES, EDGECYCLES] = ALLCYCLES(G) also returns a cell array
% EDGECYCLES in which EDGECYCLES{
i} contains the edges on the cycle
% CYCLES{
i} of G.
%
% [...] = ALLCYCLES(G, Name, Value) specifies one or more additional
% options using name-value pair arguments. The available options are:
%
% 'MaxNumCycles' - A scalar that specifies the maximum number
% of cycles in the output.
% 'MaxCycleLength' - A scalar that specifies the maximum cycle
% length of cycles in the output.
% 'MinCycleLength' - A scalar that specifies the minimum cycle
% length of cycles in the output.
%
% See also ISDAG, HASCYCLES, CYCLEBASIS, ALLPATHS
% Copyright 2020-2021 The MathWorks, Inc.
%
% Reference:
% Johnson, Donald B. "Finding all the elementary circuits of a directed
% graph." SIAM Journal on Computing 4.1 (1975): 77-84.
[maxNumCycles, maxCycleLength, minCycleLength] = parseInputs(varargin{
:});
if maxCycleLength < minCycleLength
cycles = cell(0, 1);
edgecycles = cell(0, 1);
return
end
try
if nargout < 2
cycles = allSimpleCycles(G.Underlying, maxNumCycles, maxCycleLength,...
minCycleLength);
else
[cycles, edgecycles] = allSimpleCycles(G.Underlying, maxNumCycles,...
maxCycleLength, minCycleLength);
end
catch e
if e.identifier == "MATLAB:nomem"
error(message('MATLAB:graphfun:allcycles:nomem'));
else
rethrow(e);
end
end
[names, hasNodeNames] = getNodeNames(G);
names = names.';
if hasNodeNames
for i = 1:size(cycles, 1)
cycles{
i} = names(cycles{
i});
end
end
end
function [maxNumCycles, maxCycleLength, minCycleLength] = parseInputs(varargin)
names = {
'MaxNumCycles', 'MaxCycleLength', 'MinCycleLength'};
maxNumCycles = Inf;
maxCycleLength = Inf;
minCycleLength = 1;
for i = 1:2:numel(varargin)
opt = validatestring(varargin{
i}, names);
if i+1 > numel(varargin)
error(message('MATLAB:graphfun:allcycles:KeyWithoutValue', opt));
end
switch opt
case 'MaxNumCycles'
maxNumCycles = varargin{
i+1};
validateattributes(maxNumCycles, {
'numeric'}, {
'scalar', 'real', 'nonnegative', 'integer'}, '', 'MaxNumCycles')
case 'MaxCycleLength'
maxCycleLength = varargin{
i+1};
validateattributes(maxCycleLength, {
'numeric'}, {
'scalar', 'real', 'positive', 'integer'}, '', 'MaxCycleLength')
case 'MinCycleLength'
minCycleLength = varargin{
i+1};
validateattributes(minCycleLength, {
'numeric'}, {
'scalar', 'real', 'positive', 'integer'}, '', 'MinCycleLength')
end
end
end
Un peu de fiction
Calculer toutes les périodes dans un digraphe
CYCLES
= ALLCYCLES
(G
)Calculer le digrapheG Tous les cycles de
Tableau de cellules,Parmi euxCYCLES
{ i
} Est un noeud numérique idVecteur de(SiG
Pas de nom de noeud ) Ou un tableau de cellules d'un vecteur de caractères (SiG
Nom du noeud). CYCLES
Chaque cycle commence au plus petit noeud
Index. SiG Est acyclique ,AlorsCYCLESVide. Le cycle est
Ordre de la lexicographie .
[CYCLES
, EDGECYCLES
] = ALLCYCLES
(G
) Renvoie également un tableau de cellules
EDGECYCLES
,Parmi euxEDGECYCLES
{ i
} Contient des bords sur la boucle
Cycle{- moi.}DeG.
[… = ALLCYCLES
(G
, Name
, Value
) Spécifiez une ou plusieurs valeurs supplémentaires
Utiliser le nom- Options pour les valeurs par rapport aux paramètres . Les options disponibles sont:
MaxNumCycles
- Un scalaire spécifiant le nombre maximum
Cycle de sortie.
MaxCycleLength
- Un scalaire spécifiant la période maximale
Longueur du cycle en sortie .
MinCycleLength
- Un scalaire spécifiant la période minimale
Longueur du cycle en sortie .
边栏推荐
- What about the collapse of win11 playing pubg? Solution to win11 Jedi survival crash
- AI landing new question type RPA + AI =?
- MySQL forgot how to change the password
- mpf2_ Linear programming_ CAPM_ sharpe_ Arbitrage Pricin_ Inversion Gauss Jordan_ Statsmodel_ Pulp_ pLU_ Cholesky_ QR_ Jacobi
- 未婚夫捐5亿美元给女PI,让她不用申请项目,招150位科学家,安心做科研!
- [untitled]
- 什么是Web3
- The easycvr platform is connected to the RTMP protocol, and the interface call prompts how to solve the error of obtaining video recording?
- 微信能开小号了,拼多多“砍一刀”被判侵权,字节VR设备出货量全球第二,今日更多大新闻在此
- A series of shortcut keys for jetbrain pychar
猜你喜欢
[ArcGIS tutorial] thematic map production - population density distribution map - population density analysis
九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!
Five years of automated testing, and finally into the ByteDance, the annual salary of 30W is not out of reach
NTU notes 6422quiz review (1-3 sections)
英特尔与信步科技共同打造机器视觉开发套件,协力推动工业智能化转型
Case reward: Intel brings many partners to promote the innovation and development of multi domain AI industry
AI landing new question type RPA + AI =?
How to solve the problem of adding RTSP device to easycvr cluster version and prompting server ID error?
Network Security Learning - Information Collection
What about the collapse of win11 playing pubg? Solution to win11 Jedi survival crash
随机推荐
NTU notes 6422quiz review (1-3 sections)
Wechat can play the trumpet. Pinduoduo was found guilty of infringement. The shipment of byte VR equipment ranks second in the world. Today, more big news is here
Acl2022 | decomposed meta learning small sample named entity recognition
赠票速抢|行业大咖纵论软件的质量与效能 QECon大会来啦
How do test / development programmers get promoted? From nothing, from thin to thick
Camera calibration (I): robot hand eye calibration
Surpassing postman, the new generation of domestic debugging tool apifox is elegant enough to use
JetBrain Pycharm的一系列快捷键
軟件測試之網站測試如何進行?測試小攻略走起!
[multi threading exercise] write a multi threading example of the producer consumer model.
[untitled]
Data security -- 12 -- Analysis of privacy protection
Kotlin compose text supports two colors
Implementation of JSTL custom function library
NFT meta universe chain diversified ecosystem development case
Detect when a tab bar item is pressed
Why does WordPress open so slowly?
1.19.11. SQL client, start SQL client, execute SQL query, environment configuration file, restart policy, user-defined functions, constructor parameters
DFS和BFS概念及实践+acwing 842 排列数字(dfs) +acwing 844. 走迷宫(bfs)
What if the win11 screenshot key cannot be used? Solution to the failure of win11 screenshot key