当前位置:网站首页>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 .
边栏推荐
- Both primary and secondary equipment numbers are 0
- Web3 社区中使用的术语
- Up to 5million per person per year! Choose people instead of projects, focus on basic scientific research, and scientists dominate the "new cornerstone" funded by Tencent to start the application
- Win11截图键无法使用怎么办?Win11截图键无法使用的解决方法
- Nanopineo use development process record
- [coded font series] opendyslexic font
- Highly paid programmers & interview questions. Are you familiar with the redis cluster principle of series 120? How to ensure the high availability of redis (Part 1)?
- B站大佬用我的世界搞出卷积神经网络,LeCun转发!爆肝6个月,播放破百万
- AI landing new question type RPA + AI =?
- Win11玩绝地求生(PUBG)崩溃怎么办?Win11玩绝地求生崩溃解决方法
猜你喜欢
Win11图片打不开怎么办?Win11无法打开图片的修复方法
Vscode 如何使用内置浏览器?
图灵诞辰110周年,智能机器预言成真了吗?
用CPU方案打破内存墙?学PayPal堆傲腾扩容量,漏查欺诈交易量可降至1/30
DFS和BFS概念及实践+acwing 842 排列数字(dfs) +acwing 844. 走迷宫(bfs)
Lessons and thoughts of the first SQL injection
Ssm+jsp realizes the warehouse management system, and the interface is called an elegant interface
[written to the person who first published the paper] common problems in writing comprehensive scientific and Technological Papers
EasyCVR平台接入RTMP协议,接口调用提示获取录像错误该如何解决?
AI 落地新题型 RPA + AI =?
随机推荐
EasyCVR视频广场点击播放时,主菜单高亮效果消失问题的修复
JetBrain Pycharm的一系列快捷键
The easycvr platform is connected to the RTMP protocol, and the interface call prompts how to solve the error of obtaining video recording?
英特尔David Tuhy:英特尔傲腾技术成功的原因
一图看懂!为什么学校教了你Coding但还是不会的原因...
Jetson nano configures pytorch deep learning environment / / to be improved
ESG全球领导者峰会|英特尔王锐:以科技之力应对全球气候挑战
用CPU方案打破内存墙?学PayPal堆傲腾扩容量,漏查欺诈交易量可降至1/30
How do test / development programmers get promoted? From nothing, from thin to thick
Win11远程桌面连接怎么打开?Win11远程桌面连接的五种方法
Zhou Yajin, a top safety scholar of Zhejiang University, is a curiosity driven activist
Lessons and thoughts of the first SQL injection
Optimization of channel status offline of other server devices caused by easycvr cluster restart
True global ventures' newly established $146million follow-up fund was closed, of which the general partner subscribed $62million to invest in Web3 winners in the later stage
A detailed explanation of head pose estimation [collect good articles]
案例大赏:英特尔携众多合作伙伴推动多领域AI产业创新发展
程序员上班摸鱼,这么玩才高端!
Surpassing postman, the new generation of domestic debugging tool apifox is elegant enough to use
GPT-3当一作自己研究自己,已投稿,在线蹲一个同行评议
Dab-detr: dynamic anchor boxes are better queries for Detr translation