???-?????????????????????????????????????????Objective-C??????-?????
#ifndef Edge_H #define Edge_H @interface Edge : NSObject @property (nonatomic) NSInteger source; @property (nonatomic) NSInteger destination; @property (nonatomic) Double weight; @end #endif
???-???????????????????????????????????????
@interface Edge : NSObject @property (nonatomic) NSInteger source; @property (nonatomic) NSInteger destination; @property (nonatomic) Double weight; @end @implementation Edge (instancetype)initWithSource:(NSInteger)s destination:(NSInteger)d weight:(Double)w { self = [super init]; self.source = s; self.destination = d; self.weight = w; return self; } (NSString *)description { return [NSString stringWithFormat:@"???%@?%@???=%.2f", self.source, self.destination, self.weight]; } @end #endif ?Objective-C??????-????????????????
????
????????????????????????
???????
???????????????????????????????0????????
?????
?????????????????????
?????-????
????????n-1?????????????
????
???????????????????????????????
???-?????????????????????????????Objective-C???????????????????????